X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignViewport.java;h=b088e0868acd7d1074be861dc08e357cb4b249c0;hb=ad15cff29620f960119f80176f1fd443da9f6763;hp=1a328f9a936cd4b85cdb7928fa21195ca10aff54;hpb=227ee1c1c69c228b67d408a0a83ae51bf5811272;p=jalview.git diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index 1a328f9..b088e08 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2) - * Copyright (C) 2014 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -38,12 +38,12 @@ */ package jalview.gui; +import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; import jalview.analysis.NJTree; import jalview.api.AlignViewportI; import jalview.bin.Cache; -import jalview.datamodel.AlignmentAnnotation; +import jalview.commands.CommandI; import jalview.datamodel.AlignmentI; -import jalview.datamodel.Annotation; import jalview.datamodel.ColumnSelection; import jalview.datamodel.PDBEntry; import jalview.datamodel.Sequence; @@ -95,9 +95,7 @@ public class AlignViewport extends AlignmentViewport implements boolean renderGaps = true; - boolean showSequenceFeatures = false; - - boolean showAnnotation = true; + SequenceAnnotationOrder sortAnnotationsBy = null; int charHeight; @@ -123,12 +121,6 @@ public class AlignViewport extends AlignmentViewport implements boolean cursorMode = false; - /** - * Keys are the feature types which are currently visible. Note: Values are - * not used! - */ - private Hashtable featuresDisplayed = null; - boolean antiAlias = false; Rectangle explodedPosition; @@ -137,9 +129,9 @@ public class AlignViewport extends AlignmentViewport implements boolean gatherViewsHere = false; - Stack historyList = new Stack(); + Stack historyList = new Stack(); - Stack redoList = new Stack(); + Stack redoList = new Stack(); int thresholdTextColour = 0; @@ -147,8 +139,7 @@ public class AlignViewport extends AlignmentViewport implements Color textColour2 = Color.white; - boolean rightAlignIds = false; - + private AnnotationColumnChooser annotationColumnSelectionState; /** * Creates a new AlignViewport object. * @@ -204,16 +195,7 @@ public class AlignViewport extends AlignmentViewport implements setAlignment(al); if (hiddenColumns != null) { - this.colSel = hiddenColumns; - if (hiddenColumns.getHiddenColumns() != null - && hiddenColumns.getHiddenColumns().size() > 0) - { - hasHiddenColumns = true; - } - else - { - hasHiddenColumns = false; - } + colSel = hiddenColumns; } init(); } @@ -260,16 +242,7 @@ public class AlignViewport extends AlignmentViewport implements setAlignment(al); if (hiddenColumns != null) { - this.colSel = hiddenColumns; - if (hiddenColumns.getHiddenColumns() != null - && hiddenColumns.getHiddenColumns().size() > 0) - { - hasHiddenColumns = true; - } - else - { - hasHiddenColumns = false; - } + colSel = hiddenColumns; } init(); } @@ -284,9 +257,9 @@ public class AlignViewport extends AlignmentViewport implements antiAlias = Cache.getDefault("ANTI_ALIAS", false); showJVSuffix = Cache.getDefault("SHOW_JVSUFFIX", true); - showAnnotation = Cache.getDefault("SHOW_ANNOTATIONS", true); + setShowAnnotation(Cache.getDefault("SHOW_ANNOTATIONS", true)); - rightAlignIds = Cache.getDefault("RIGHT_ALIGN_IDS", false); + setRightAlignIds(Cache.getDefault("RIGHT_ALIGN_IDS", false)); centreColumnLabels = Cache.getDefault("CENTRE_COLUMN_LABELS", false); autoCalculateConsensus = Cache.getDefault("AUTO_CALC_CONSENSUS", true); @@ -334,10 +307,6 @@ public class AlignViewport extends AlignmentViewport implements false); showGroupConsensus = Cache.getDefault("SHOW_GROUP_CONSENSUS", false); showConsensus = Cache.getDefault("SHOW_IDENTITY", true); - consensus = new AlignmentAnnotation("Consensus", "PID", - new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH); - consensus.hasText = true; - consensus.autoCalculated = true; } initAutoAnnotation(); if (jalview.bin.Cache.getProperty("DEFAULT_COLOUR") != null) @@ -358,28 +327,15 @@ public class AlignViewport extends AlignmentViewport implements } } - wrapAlignment = jalview.bin.Cache.getDefault("WRAP_ALIGNMENT", false); - showUnconserved = jalview.bin.Cache.getDefault("SHOW_UNCONSERVED", - false); - sortByTree = jalview.bin.Cache.getDefault("SORT_BY_TREE", false); - followSelection = jalview.bin.Cache.getDefault("FOLLOW_SELECTIONS", - true); - } - - /** - * set the flag - * - * @param b - * features are displayed if true - */ - public void setShowSequenceFeatures(boolean b) - { - showSequenceFeatures = b; - } - - public boolean getShowSequenceFeatures() - { - return showSequenceFeatures; + wrapAlignment = Cache.getDefault("WRAP_ALIGNMENT", false); + showUnconserved = Cache.getDefault("SHOW_UNCONSERVED", false); + sortByTree = Cache.getDefault("SORT_BY_TREE", false); + followSelection = Cache.getDefault("FOLLOW_SELECTIONS", true); + sortAnnotationsBy = SequenceAnnotationOrder.valueOf(Cache.getDefault( + Preferences.SORT_ANNOTATIONS, + SequenceAnnotationOrder.NONE.name())); + showAutocalculatedAbove = Cache.getDefault( + Preferences.SHOW_AUTOCALC_ABOVE, false); } /** @@ -836,27 +792,6 @@ public class AlignViewport extends AlignmentViewport implements * * @return DOCUMENT ME! */ - public boolean getShowAnnotation() - { - return showAnnotation; - } - - /** - * DOCUMENT ME! - * - * @param b - * DOCUMENT ME! - */ - public void setShowAnnotation(boolean b) - { - showAnnotation = b; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ public boolean getScaleAboveWrapped() { return scaleAboveWrapped; @@ -969,8 +904,10 @@ public class AlignViewport extends AlignmentViewport implements { // TODO: JAL-1126 if (historyList == null || redoList == null) + { return new long[] { -1, -1 }; + } return new long[] { historyList.hashCode(), this.redoList.hashCode() }; } @@ -1054,23 +991,6 @@ public class AlignViewport extends AlignmentViewport implements shownpfeats = show; } - /** - * - * @return true if view has hidden rows - */ - public boolean hasHiddenRows() - { - return hasHiddenRows; - } - - /** - * - * @return true if view has hidden columns - */ - public boolean hasHiddenColumns() - { - return hasHiddenColumns; - } /** * when set, view will scroll to show the highlighted position @@ -1098,8 +1018,6 @@ public class AlignViewport extends AlignmentViewport implements return followSelection; } - boolean showSeqFeaturesHeight; - public void sendSelection() { jalview.structure.StructureSelectionManager @@ -1108,16 +1026,6 @@ public class AlignViewport extends AlignmentViewport implements new ColumnSelection(getColumnSelection()), this); } - public void setShowSequenceFeaturesHeight(boolean selected) - { - showSeqFeaturesHeight = selected; - } - - public boolean getShowSequenceFeaturesHeight() - { - return showSeqFeaturesHeight; - } - /** * return the alignPanel containing the given viewport. Use this to get the * components currently handling the given viewport. @@ -1207,7 +1115,9 @@ public class AlignViewport extends AlignmentViewport implements Vector pdbs = alignment.getSequenceAt(i).getDatasetSequence() .getPDBId(); if (pdbs == null) + { continue; + } SequenceI sq; for (int p = 0; p < pdbs.size(); p++) { @@ -1215,7 +1125,9 @@ public class AlignViewport extends AlignmentViewport implements if (p1.getId().equals(pdb.getId())) { if (!seqs.contains(sq = alignment.getSequenceAt(i))) + { seqs.add(sq); + } continue; } @@ -1247,6 +1159,8 @@ public class AlignViewport extends AlignmentViewport implements private Hashtable calcIdParams = new Hashtable(); + private boolean showAutocalculatedAbove; + public AutoCalcSetting getCalcIdSettingsFor(String calcId) { return calcIdParams.get(calcId); @@ -1265,13 +1179,34 @@ public class AlignViewport extends AlignmentViewport implements } } - public Hashtable getFeaturesDisplayed() + protected SequenceAnnotationOrder getSortAnnotationsBy() + { + return sortAnnotationsBy; + } + + protected void setSortAnnotationsBy(SequenceAnnotationOrder sortAnnotationsBy) + { + this.sortAnnotationsBy = sortAnnotationsBy; + } + + protected boolean isShowAutocalculatedAbove() + { + return showAutocalculatedAbove; + } + + protected void setShowAutocalculatedAbove(boolean showAutocalculatedAbove) + { + this.showAutocalculatedAbove = showAutocalculatedAbove; + } + + public AnnotationColumnChooser getAnnotationColumnSelectionState() { - return featuresDisplayed; + return annotationColumnSelectionState; } - public void setFeaturesDisplayed(Hashtable featuresDisplayed) + public void setAnnotationColumnSelectionState( + AnnotationColumnChooser currentAnnotationColumnSelectionState) { - this.featuresDisplayed = featuresDisplayed; + this.annotationColumnSelectionState = currentAnnotationColumnSelectionState; } }