From: gmungoc Date: Thu, 3 Sep 2015 10:37:16 +0000 (+0100) Subject: JAL-1690 scaleProteinAsCdna new optional attribute on Viewport in X-Git-Tag: Release_2_10_0~505^2~2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=4316d4573368e1c5455f84c6fcb96aa3a1e48045;p=jalview.git JAL-1690 scaleProteinAsCdna new optional attribute on Viewport in project file --- diff --git a/schemas/jalview.xsd b/schemas/jalview.xsd index f60bb6a..850b223 100755 --- a/schemas/jalview.xsd +++ b/schemas/jalview.xsd @@ -430,6 +430,7 @@ + diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 23b09de..2f90e91 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -20,6 +20,7 @@ */ package jalview.gui; +import jalview.api.ViewStyleI; import jalview.api.structures.JalviewStructureDisplayI; import jalview.bin.Cache; import jalview.datamodel.AlignedCodonFrame; @@ -1149,6 +1150,7 @@ public class Jalview2XML view.setFontName(av.font.getName()); view.setFontSize(av.font.getSize()); view.setFontStyle(av.font.getStyle()); + view.setScaleProteinAsCdna(av.getViewStyle().isScaleProteinAsCdna()); view.setRenderGaps(av.isRenderGaps()); view.setShowAnnotation(av.isShowAnnotation()); view.setShowBoxes(av.getShowBoxes()); @@ -4194,6 +4196,9 @@ public class Jalview2XML af.viewport.setFont( new java.awt.Font(view.getFontName(), view.getFontStyle(), view .getFontSize()), true); + ViewStyleI vs = af.viewport.getViewStyle(); + vs.setScaleProteinAsCdna(view.isScaleProteinAsCdna()); + af.viewport.setViewStyle(vs); // TODO: allow custom charWidth/Heights to be restored by updating them // after setting font - which means set above to false af.viewport.setRenderGaps(view.getRenderGaps()); diff --git a/src/jalview/schemabinding/version2/.castor.cdr b/src/jalview/schemabinding/version2/.castor.cdr index e01bbd4..361fb7c 100644 --- a/src/jalview/schemabinding/version2/.castor.cdr +++ b/src/jalview/schemabinding/version2/.castor.cdr @@ -1,4 +1,4 @@ -#Fri Jun 26 14:22:47 BST 2015 +#Thu Sep 03 10:55:37 BST 2015 jalview.schemabinding.version2.ThresholdLine=jalview.schemabinding.version2.descriptors.ThresholdLineDescriptor jalview.schemabinding.version2.SequenceSetProperties=jalview.schemabinding.version2.descriptors.SequenceSetPropertiesDescriptor jalview.schemabinding.version2.StructureState=jalview.schemabinding.version2.descriptors.StructureStateDescriptor diff --git a/src/jalview/schemabinding/version2/Viewport.java b/src/jalview/schemabinding/version2/Viewport.java index 136a3b3..e3a19de 100644 --- a/src/jalview/schemabinding/version2/Viewport.java +++ b/src/jalview/schemabinding/version2/Viewport.java @@ -332,6 +332,16 @@ public class Viewport implements java.io.Serializable { private boolean _has_fontStyle; /** + * Field _scaleProteinAsCdna. + */ + private boolean _scaleProteinAsCdna = true; + + /** + * keeps track of state for field: _scaleProteinAsCdna + */ + private boolean _has_scaleProteinAsCdna; + + /** * Field _viewName. */ private java.lang.String _viewName; @@ -631,6 +641,13 @@ public class Viewport implements java.io.Serializable { /** */ + public void deleteScaleProteinAsCdna( + ) { + this._has_scaleProteinAsCdna= false; + } + + /** + */ public void deleteShowAnnotation( ) { this._has_showAnnotation= false; @@ -1107,6 +1124,16 @@ public class Viewport implements java.io.Serializable { } /** + * Returns the value of field 'scaleProteinAsCdna'. + * + * @return the value of field 'ScaleProteinAsCdna'. + */ + public boolean getScaleProteinAsCdna( + ) { + return this._scaleProteinAsCdna; + } + + /** * Returns the value of field 'sequenceSetId'. * * @return the value of field 'SequenceSetId'. @@ -1510,6 +1537,16 @@ public class Viewport implements java.io.Serializable { } /** + * Method hasScaleProteinAsCdna. + * + * @return true if at least one ScaleProteinAsCdna has been adde + */ + public boolean hasScaleProteinAsCdna( + ) { + return this._has_scaleProteinAsCdna; + } + + /** * Method hasShowAnnotation. * * @return true if at least one ShowAnnotation has been added @@ -1834,6 +1871,16 @@ public class Viewport implements java.io.Serializable { } /** + * Returns the value of field 'scaleProteinAsCdna'. + * + * @return the value of field 'ScaleProteinAsCdna'. + */ + public boolean isScaleProteinAsCdna( + ) { + return this._scaleProteinAsCdna; + } + + /** * Returns the value of field 'showAnnotation'. * * @return the value of field 'ShowAnnotation'. @@ -2382,6 +2429,18 @@ public class Viewport implements java.io.Serializable { } /** + * Sets the value of field 'scaleProteinAsCdna'. + * + * @param scaleProteinAsCdna the value of field + * 'scaleProteinAsCdna'. + */ + public void setScaleProteinAsCdna( + final boolean scaleProteinAsCdna) { + this._scaleProteinAsCdna = scaleProteinAsCdna; + this._has_scaleProteinAsCdna = true; + } + + /** * Sets the value of field 'sequenceSetId'. * * @param sequenceSetId the value of field 'sequenceSetId'. diff --git a/src/jalview/schemabinding/version2/descriptors/ViewportDescriptor.java b/src/jalview/schemabinding/version2/descriptors/ViewportDescriptor.java index 0044f5b..cea458c 100644 --- a/src/jalview/schemabinding/version2/descriptors/ViewportDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/ViewportDescriptor.java @@ -1375,6 +1375,47 @@ public class ViewportDescriptor extends org.exolab.castor.xml.util.XMLClassDescr typeValidator.setMaxInclusive(2147483647); } desc.setValidator(fieldValidator); + //-- _scaleProteinAsCdna + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_scaleProteinAsCdna", "scaleProteinAsCdna", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Viewport target = (Viewport) object; + if (!target.hasScaleProteinAsCdna()) { return null; } + return (target.getScaleProteinAsCdna() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Viewport target = (Viewport) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteScaleProteinAsCdna(); + return; + } + target.setScaleProteinAsCdna( ((java.lang.Boolean) value).booleanValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _scaleProteinAsCdna + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.BooleanValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); //-- _viewName desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_viewName", "viewName", org.exolab.castor.xml.NodeType.Attribute); desc.setImmutable(true);