- int startRes;
- int endRes;
- int startSeq;
- int endSeq;
- boolean showJVSuffix = true;
- boolean showText = true;
- boolean showColourText = false;
- boolean showBoxes = true;
- boolean wrapAlignment = false;
- boolean renderGaps = true;
- boolean showSequenceFeatures = false;
- boolean showAnnotation = true;
- boolean showConservation = true;
- boolean showQuality = true;
- boolean showIdentity = true;
- boolean colourAppliesToAllGroups = true;
- ColourSchemeI globalColourScheme = null;
- boolean conservationColourSelected = false;
- boolean abovePIDThreshold = false;
- SequenceGroup selectionGroup;
- int charHeight;
- int charWidth;
- boolean validCharWidth;
- int wrappedWidth;
- Font font;
- AlignmentI alignment;
- ColumnSelection colSel = new ColumnSelection();
- int threshold;
- int increment;
- NJTree currentTree = null;
- boolean scaleAboveWrapped = false;
- boolean scaleLeftWrapped = true;
- boolean scaleRightWrapped = true;
- boolean hasHiddenColumns = false;
- boolean hasHiddenRows = false;
- boolean showHiddenMarkers = true;
-
- boolean cursorMode = false;
-
- // The following vector holds the features which are
- // currently visible, in the correct order or rendering
- Hashtable featuresDisplayed = null;
-
-
- /** DOCUMENT ME!! */
- public Hashtable [] hconsensus;
- AlignmentAnnotation consensus;
- AlignmentAnnotation conservation;
- AlignmentAnnotation quality;
- boolean autoCalculateConsensus = true;
-
- /** DOCUMENT ME!! */
- public int ConsPercGaps = 25; // JBPNote : This should be a scalable property!
-
- // JBPNote Prolly only need this in the applet version.
- private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(this);
-
- boolean ignoreGapsInConsensusCalculation = false;
-
- boolean isDataset = false;
-
- boolean antiAlias = false;
-
- boolean padGaps = false;
-
- Rectangle explodedPosition;
-
- String viewName;
-
- String sequenceSetID;
-
- boolean gatherViewsHere = false;
-
-
- public AlignViewport(AlignmentI al, boolean dataset)
- {
- isDataset = dataset;
- setAlignment(al);
- init();
+ Font font;
+
+ NJTree currentTree = null;
+
+ boolean cursorMode = false;
+
+ boolean antiAlias = false;
+
+ private Rectangle explodedGeometry;
+
+ String viewName;
+
+ /*
+ * Flag set true on the view that should 'gather' multiple views of the same
+ * sequence set id when a project is reloaded. Set false on all views when
+ * they are 'exploded' into separate windows. Set true on the current view
+ * when 'Gather' is performed, and also on the first tab when the first new
+ * view is created.
+ */
+ private boolean gatherViewsHere = false;
+
+ private AnnotationColumnChooser annotationColumnSelectionState;
+
+ /**
+ * Creates a new AlignViewport object.
+ *
+ * @param al
+ * alignment to view
+ */
+ public AlignViewport(AlignmentI al)
+ {
+ setAlignment(al);
+ init();
+ }
+
+ /**
+ * Create a new AlignViewport object with a specific sequence set ID
+ *
+ * @param al
+ * @param seqsetid
+ * (may be null - but potential for ambiguous constructor exception)
+ */
+ public AlignViewport(AlignmentI al, String seqsetid)
+ {
+ this(al, seqsetid, null);
+ }
+
+ public AlignViewport(AlignmentI al, String seqsetid, String viewid)
+ {
+ sequenceSetID = seqsetid;
+ viewId = viewid;
+ // TODO remove these once 2.4.VAMSAS release finished
+ if (Cache.log != null && Cache.log.isDebugEnabled() && seqsetid != null)
+ {
+ Cache.log.debug("Setting viewport's sequence set id : "
+ + sequenceSetID);
+ }
+ if (Cache.log != null && Cache.log.isDebugEnabled() && viewId != null)
+ {
+ Cache.log.debug("Setting viewport's view id : " + viewId);
+ }
+ setAlignment(al);
+ init();
+ }
+
+ /**
+ * Create a new AlignViewport with hidden regions
+ *
+ * @param al
+ * AlignmentI
+ * @param hiddenColumns
+ * ColumnSelection
+ */
+ public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns)
+ {
+ setAlignment(al);
+ if (hiddenColumns != null)
+ {
+ colSel = hiddenColumns;
+ }
+ init();
+ }
+
+ /**
+ * New viewport with hidden columns and an existing sequence set id
+ *
+ * @param al
+ * @param hiddenColumns
+ * @param seqsetid
+ * (may be null)
+ */
+ public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns,
+ String seqsetid)
+ {
+ this(al, hiddenColumns, seqsetid, null);
+ }
+
+ /**
+ * New viewport with hidden columns and an existing sequence set id and viewid
+ *
+ * @param al
+ * @param hiddenColumns
+ * @param seqsetid
+ * (may be null)
+ * @param viewid
+ * (may be null)
+ */
+ public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns,
+ String seqsetid, String viewid)
+ {
+ sequenceSetID = seqsetid;
+ viewId = viewid;
+ // TODO remove these once 2.4.VAMSAS release finished
+ if (Cache.log != null && Cache.log.isDebugEnabled() && seqsetid != null)
+ {
+ Cache.log.debug("Setting viewport's sequence set id : "
+ + sequenceSetID);
+ }
+ if (Cache.log != null && Cache.log.isDebugEnabled() && viewId != null)
+ {
+ Cache.log.debug("Setting viewport's view id : " + viewId);
+ }
+ setAlignment(al);
+ if (hiddenColumns != null)
+ {
+ colSel = hiddenColumns;
+ }
+ init();
+ }
+
+ /**
+ * Apply any settings saved in user preferences
+ */
+ private void applyViewProperties()
+ {
+ antiAlias = Cache.getDefault("ANTI_ALIAS", false);
+
+ viewStyle.setShowJVSuffix(Cache.getDefault("SHOW_JVSUFFIX", true));
+ setShowAnnotation(Cache.getDefault("SHOW_ANNOTATIONS", true));
+
+ setRightAlignIds(Cache.getDefault("RIGHT_ALIGN_IDS", false));
+ setCentreColumnLabels(Cache.getDefault("CENTRE_COLUMN_LABELS", false));
+ autoCalculateConsensus = Cache.getDefault("AUTO_CALC_CONSENSUS", true);
+
+ setPadGaps(Cache.getDefault("PAD_GAPS", true));
+ setShowNPFeats(Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true));
+ setShowDBRefs(Cache.getDefault("SHOW_DBREFS_TOOLTIP", true));
+ viewStyle.setSeqNameItalics(Cache.getDefault("ID_ITALICS", true));
+ viewStyle.setWrapAlignment(Cache.getDefault("WRAP_ALIGNMENT", false));
+ viewStyle.setShowUnconserved(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);
+ viewStyle.setScaleProteinAsCdna(Cache.getDefault(
+ Preferences.SCALE_PROTEIN_TO_CDNA, true));
+ }
+
+ void init()
+ {
+ this.startRes = 0;
+ this.endRes = alignment.getWidth() - 1;
+ this.startSeq = 0;
+ this.endSeq = alignment.getHeight() - 1;
+ applyViewProperties();
+
+ String fontName = Cache.getDefault("FONT_NAME", "SansSerif");
+ String fontStyle = Cache.getDefault("FONT_STYLE", Font.PLAIN + "");
+ String fontSize = Cache.getDefault("FONT_SIZE", "10");
+
+ int style = 0;
+
+ if (fontStyle.equals("bold"))
+ {
+ style = 1;
+ }
+ else if (fontStyle.equals("italic"))
+ {
+ style = 2;
+ }
+
+ setFont(new Font(fontName, style, Integer.parseInt(fontSize)), true);
+
+ alignment
+ .setGapCharacter(Cache.getDefault("GAP_SYMBOL", "-").charAt(0));
+
+ // We must set conservation and consensus before setting colour,
+ // as Blosum and Clustal require this to be done
+ if (hconsensus == null && !isDataset)
+ {
+ if (!alignment.isNucleotide())
+ {
+ showConservation = Cache.getDefault("SHOW_CONSERVATION", true);
+ showQuality = Cache.getDefault("SHOW_QUALITY", true);
+ showGroupConservation = Cache.getDefault("SHOW_GROUP_CONSERVATION",
+ false);
+ }
+ showConsensusHistogram = Cache.getDefault("SHOW_CONSENSUS_HISTOGRAM",
+ true);
+ showSequenceLogo = Cache.getDefault("SHOW_CONSENSUS_LOGO", false);
+ normaliseSequenceLogo = Cache.getDefault("NORMALISE_CONSENSUS_LOGO",
+ false);
+ showGroupConsensus = Cache.getDefault("SHOW_GROUP_CONSENSUS", false);
+ showConsensus = Cache.getDefault("SHOW_IDENTITY", true);