*/
package jalview.viewmodel;
+import java.awt.Color;
+import java.beans.PropertyChangeSupport;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
import jalview.analysis.Conservation;
import jalview.analysis.TreeModel;
import jalview.api.AlignCalcManagerI;
+import jalview.api.AlignExportSettingsI;
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.api.FeaturesDisplayedI;
import jalview.api.ViewStyleI;
+import jalview.bin.Console;
import jalview.commands.CommandI;
import jalview.datamodel.AlignedCodonFrame;
import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentExportData;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentView;
import jalview.datamodel.Annotation;
import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.ContactListI;
+import jalview.datamodel.ContactMatrixI;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.HiddenSequences;
import jalview.datamodel.ProfilesI;
import jalview.datamodel.SequenceCollectionI;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
+import jalview.gui.QuitHandler;
+import jalview.project.Jalview2XML;
import jalview.renderer.ResidueShader;
import jalview.renderer.ResidueShaderI;
import jalview.schemes.ColourSchemeI;
import jalview.workers.ConsensusThread;
import jalview.workers.StrucConsensusThread;
-import java.awt.Color;
-import java.beans.PropertyChangeSupport;
-import java.util.ArrayDeque;
-import java.util.ArrayList;
-import java.util.BitSet;
-import java.util.Deque;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
/**
* base class holding visualization and analysis attributes and common logic for
* an active alignment view displayed in the GUI
protected Deque<CommandI> redoList = new ArrayDeque<>();
/**
+ * used to determine if quit should be confirmed
+ */
+ private boolean savedUpToDate = false;
+
+ /**
* alignment displayed in the viewport. Please use get/setter
*/
protected AlignmentI alignment;
* retain any colour thresholds per group while
* changing choice of colour scheme (JAL-2386)
*/
- sg.setColourScheme(
- cs == null ? null : cs.getInstance(this, sg));
+ sg.setColourScheme(cs == null ? null : cs.getInstance(this, sg));
if (cs != null)
{
sg.getGroupColourScheme().alignmentChanged(sg,
/**
* results of cDNA complement consensus visible portion of view
*/
- protected Hashtable[] hcomplementConsensus = null;
+ protected Hashtable<String, Object>[] hcomplementConsensus = null;
/**
* results of secondary structure base pair consensus for visible portion of
* view
*/
- protected Hashtable[] hStrucConsensus = null;
+ protected Hashtable<String, Object>[] hStrucConsensus = null;
protected Conservation hconservation = null;
}
@Override
- public void setComplementConsensusHash(Hashtable[] hconsensus)
+ public void setComplementConsensusHash(
+ Hashtable<String, Object>[] hconsensus)
{
this.hcomplementConsensus = hconsensus;
}
}
@Override
- public Hashtable[] getComplementConsensusHash()
+ public Hashtable<String, Object>[] getComplementConsensusHash()
{
return hcomplementConsensus;
}
@Override
- public Hashtable[] getRnaStructureConsensusHash()
+ public Hashtable<String, Object>[] getRnaStructureConsensusHash()
{
return hStrucConsensus;
}
@Override
- public void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus)
+ public void setRnaStructureConsensusHash(
+ Hashtable<String, Object>[] hStrucConsensus)
{
this.hStrucConsensus = hStrucConsensus;
ranges = null;
currentTree = null;
selectionGroup = null;
+ colSel = null;
setAlignment(null);
}
}
} while (end < max);
- int[][] startEnd = new int[regions.size()][2];
+ // int[][] startEnd = new int[regions.size()][2];
return regions;
}
AlignmentAnnotation clone = new AlignmentAnnotation(annot);
if (selectedOnly && selectionGroup != null)
{
- clone.makeVisibleAnnotation(
- selectionGroup.getStartRes(), selectionGroup.getEndRes(),
- alignment.getHiddenColumns());
+ clone.makeVisibleAnnotation(selectionGroup.getStartRes(),
+ selectionGroup.getEndRes(), alignment.getHiddenColumns());
}
else
{
if (aa.graph > 0)
{
- aa.height += aa.graphHeight;
+ aa.height += aa.graphHeight+20;
}
if (aa.height == 0)
* TODO reorder the annotation rows according to group/sequence ordering on
* alignment
*/
- boolean sortg = true;
+ // boolean sortg = true;
// remove old automatic annotation
// add any new annotation
public void clearSequenceColours()
{
sequenceColours.clear();
- };
+ }
@Override
public AlignViewportI getCodingComplement()
{
this.historyList.push(command);
broadcastCommand(command, false);
+ setSavedUpToDate(false);
+ Jalview2XML.setStateSavedUpToDate(false);
}
}
return searchResults;
}
+ @Override
+ public ContactListI getContactList(AlignmentAnnotation _aa, int column)
+ {
+ return alignment.getContactListFor(_aa, column);
+ }
+
+ @Override
+ public ContactMatrixI getContactMatrix(
+ AlignmentAnnotation alignmentAnnotation)
+ {
+ return alignment.getContactMatrixFor(alignmentAnnotation);
+ }
+
/**
* get the consensus sequence as displayed under the PID consensus annotation
* row.
return currentTree;
}
+ @Override
+ public AlignmentExportData getAlignExportData(
+ AlignExportSettingsI options)
+ {
+ AlignmentI alignmentToExport = null;
+ String[] omitHidden = null;
+ alignmentToExport = null;
+
+ if (hasHiddenColumns() && !options.isExportHiddenColumns())
+ {
+ omitHidden = getViewAsString(false,
+ options.isExportHiddenSequences());
+ }
+
+ int[] alignmentStartEnd = new int[2];
+ if (hasHiddenRows() && options.isExportHiddenSequences())
+ {
+ alignmentToExport = getAlignment().getHiddenSequences()
+ .getFullAlignment();
+ }
+ else
+ {
+ alignmentToExport = getAlignment();
+ }
+ alignmentStartEnd = getAlignment().getHiddenColumns()
+ .getVisibleStartAndEndIndex(alignmentToExport.getWidth());
+ AlignmentExportData ed = new AlignmentExportData(alignmentToExport,
+ omitHidden, alignmentStartEnd);
+ return ed;
+ }
+
/**
* flag set to indicate if structure views might be out of sync with sequences
* in the alignment
codingComplement.setUpdateStructures(needToUpdateStructureViews);
}
}
+
+ @Override
+ public Iterator<int[]> getViewAsVisibleContigs(boolean selectedRegionOnly)
+ {
+ int start = 0;
+ int end = 0;
+ if (selectedRegionOnly && selectionGroup != null)
+ {
+ start = selectionGroup.getStartRes();
+ end = selectionGroup.getEndRes() + 1;
+ }
+ else
+ {
+ end = alignment.getWidth();
+ }
+ return (alignment.getHiddenColumns().getVisContigsIterator(start, end,
+ false));
+ }
+
+ public void setSavedUpToDate(boolean s)
+ {
+ setSavedUpToDate(s, QuitHandler.Message.UNSAVED_CHANGES);
+ }
+
+ public void setSavedUpToDate(boolean s, QuitHandler.Message m)
+ {
+ Console.debug(
+ "Setting " + this.getViewId() + " setSavedUpToDate to " + s);
+ savedUpToDate = s;
+ QuitHandler.setMessage(m);
+ }
+
+ public boolean savedUpToDate()
+ {
+ Console.debug("Returning " + this.getViewId() + " savedUpToDate value: "
+ + savedUpToDate);
+ return savedUpToDate;
+ }
}