+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.viewmodel.styles;
-import java.awt.Color;
-
import jalview.api.ViewStyleI;
+import java.awt.Color;
+
/**
* A container for holding alignment view properties. View properties are
* data-independent, which means they can be safely copied between views
*/
private boolean scaleProteinAsCdna = true;
+ /*
+ * if true, font changes to protein or cDNA are applied to both
+ * sides of a split screen
+ */
+ private boolean proteinFontAsCdna = true;
+
/**
* Copy constructor
*
setScaleAboveWrapped(vs.getScaleAboveWrapped());
setScaleLeftWrapped(vs.getScaleLeftWrapped());
setScaleProteinAsCdna(vs.isScaleProteinAsCdna());
+ setProteinFontAsCdna(vs.isProteinFontAsCdna());
setScaleRightWrapped(vs.getScaleRightWrapped());
setSeqNameItalics(vs.isSeqNameItalics());
setShowAnnotation(vs.isShowAnnotation());
setShowNPFeats(vs.isShowNPFeats());
setShowSequenceFeaturesHeight(vs.isShowSequenceFeaturesHeight());
setShowSequenceFeatures(vs.isShowSequenceFeatures());
+ setShowComplementFeatures(vs.isShowComplementFeatures());
+ setShowComplementFeaturesOnTop(vs.isShowComplementFeaturesOnTop());
setShowText(vs.getShowText());
setShowUnconserved(vs.getShowUnconserved());
setTextColour(vs.getTextColour());
&& getScaleAboveWrapped() == vs.getScaleAboveWrapped()
&& getScaleLeftWrapped() == vs.getScaleLeftWrapped()
&& isScaleProteinAsCdna() == vs.isScaleProteinAsCdna()
+ && isProteinFontAsCdna() == vs.isProteinFontAsCdna()
&& getScaleRightWrapped() == vs.getScaleRightWrapped()
&& isSeqNameItalics() == vs.isSeqNameItalics()
&& isShowAnnotation() == vs.isShowAnnotation()
&& isShowSequenceFeaturesHeight() == vs
.isShowSequenceFeaturesHeight()
&& isShowSequenceFeatures() == vs.isShowSequenceFeatures()
+ && isShowComplementFeatures() == vs.isShowComplementFeatures()
+ && isShowComplementFeaturesOnTop() == vs
+ .isShowComplementFeaturesOnTop()
&& getShowText() == vs.getShowText()
&& getShowUnconserved() == vs.getShowUnconserved()
&& getThreshold() == vs.getThreshold()
&& getThresholdTextColour() == vs.getThresholdTextColour()
&& isUpperCasebold() == vs.isUpperCasebold()
- && getWrapAlignment() == vs.getWrapAlignment() && getWrappedWidth() == vs
- .getWrappedWidth());
+ && getWrapAlignment() == vs.getWrapAlignment()
+ && getWrappedWidth() == vs.getWrappedWidth());
/*
- * and compare non-primitive types; syntax below will match null with null values
+ * and compare non-primitive types; syntax below will match null with null
+ * values
*/
- match = match
- && String.valueOf(getFontName()).equals(
- String.valueOf(vs.getFontName()));
- match = match
- && String.valueOf(getTextColour()).equals(
- String.valueOf(vs.getTextColour()));
- match = match
- && String.valueOf(getTextColour2()).equals(
- String.valueOf(vs.getTextColour2()));
+ match = match && String.valueOf(getFontName())
+ .equals(String.valueOf(vs.getFontName()));
+ match = match && String.valueOf(getTextColour())
+ .equals(String.valueOf(vs.getTextColour()));
+ match = match && String.valueOf(getTextColour2())
+ .equals(String.valueOf(vs.getTextColour2()));
return match;
// return equivalent(this, (ViewStyle) other);
}
+ /**
+ * Overridden to ensure that whenever vs1.equals(vs2) then vs1.hashCode() ==
+ * vs2.hashCode()
+ */
@Override
public int hashCode()
{
- return 0; // TODO
+ /*
+ * No need to include all properties, just a selection...
+ */
+ int hash = 0;
+ int m = 1;
+ // Boolean.hashCode returns 1231 or 1237
+ hash += m++ * Boolean.valueOf(this.abovePIDThreshold).hashCode();
+ hash += m++ * Boolean.valueOf(this.centreColumnLabels).hashCode();
+ hash += m++ * Boolean.valueOf(this.colourAppliesToAllGroups).hashCode();
+ hash += m++ * Boolean.valueOf(this.displayReferenceSeq).hashCode();
+ hash += m++ * Boolean.valueOf(this.renderGaps).hashCode();
+ hash += m++ * Boolean.valueOf(this.rightAlignIds).hashCode();
+ hash += m++ * Boolean.valueOf(this.scaleProteinAsCdna).hashCode();
+ hash += m++ * Boolean.valueOf(this.scaleRightWrapped).hashCode();
+ hash += m++ * Boolean.valueOf(this.seqNameItalics).hashCode();
+ hash += m++ * Boolean.valueOf(this.showAnnotation).hashCode();
+ hash += m++ * Boolean.valueOf(this.showBoxes).hashCode();
+ hash += m++ * Boolean.valueOf(this.showdbrefs).hashCode();
+ hash += m++ * Boolean.valueOf(this.showJVSuffix).hashCode();
+ hash += m++ * Boolean.valueOf(this.showSequenceFeatures).hashCode();
+ hash += m++ * Boolean.valueOf(this.showUnconserved).hashCode();
+ hash += m++ * Boolean.valueOf(this.wrapAlignment).hashCode();
+ hash += m++ * this.charHeight;
+ hash += m++ * this.charWidth;
+ hash += m++ * fontSize;
+ hash += m++ * fontStyle;
+ hash += m++ * idWidth;
+ hash += String.valueOf(this.fontName).hashCode();
+ return hash;
}
+
/**
* @return the upperCasebold
*/
private int fontStyle;
+ private boolean showComplementFeatures;
+
+ private boolean showComplementFeaturesOnTop;
+
/**
* GUI state
*
abovePIDThreshold = b;
}
-
/**
* DOCUMENT ME!
*
this.charWidth = w;
}
-
/**
* @param value
* indicating if subsequent colourscheme changes will be propagated
{
this.scaleProteinAsCdna = b;
}
+
+ @Override
+ public boolean isProteinFontAsCdna()
+ {
+ return proteinFontAsCdna;
+ }
+
+ @Override
+ public void setProteinFontAsCdna(boolean b)
+ {
+ proteinFontAsCdna = b;
+ }
+
+ @Override
+ public void setShowComplementFeatures(boolean b)
+ {
+ showComplementFeatures = b;
+ }
+
+ @Override
+ public boolean isShowComplementFeatures()
+ {
+ return showComplementFeatures;
+ }
+
+ @Override
+ public void setShowComplementFeaturesOnTop(boolean b)
+ {
+ showComplementFeaturesOnTop = b;
+ }
+
+ @Override
+ public boolean isShowComplementFeaturesOnTop()
+ {
+ return showComplementFeaturesOnTop;
+ }
}