From: gmungoc Date: Thu, 14 Dec 2017 16:33:00 +0000 (+0000) Subject: JAL-2843 save/restore colour feature by attribute, and feature filters, to Jalview... X-Git-Tag: Release_2_11_0~78 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=aa4e99f8937ce22963cf32f1e92f174ee52ad7ee;p=jalview.git JAL-2843 save/restore colour feature by attribute, and feature filters, to Jalview project --- diff --git a/schemas/JalviewUserColours.xsd b/schemas/JalviewUserColours.xsd index 9cc7083..3934d66 100755 --- a/schemas/JalviewUserColours.xsd +++ b/schemas/JalviewUserColours.xsd @@ -42,18 +42,7 @@ - - - Colour if no attribute or score value - - - - - - - - - + @@ -124,4 +113,14 @@ + + + Graduated feature colour if no score (or attribute) value + + + + + + + diff --git a/schemas/jalview.xsd b/schemas/jalview.xsd index d0bdf42..48824e7 100755 --- a/schemas/jalview.xsd +++ b/schemas/jalview.xsd @@ -500,6 +500,18 @@ + + + + name of feature attribute to colour by, or attribute and sub-attribute + + + + + optional filter(s) applied to the feature type + + + + diff --git a/src/jalview/binding/types/ColourNoValueColourType.java b/src/jalview/binding/types/ColourNoValueColourType.java deleted file mode 100644 index 6b5dafa..0000000 --- a/src/jalview/binding/types/ColourNoValueColourType.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ - */ - -package jalview.binding.types; - - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import java.util.Hashtable; - -/** - * Class ColourNoValueColourType. - * - * @version $Revision$ $Date$ - */ -public class ColourNoValueColourType implements java.io.Serializable { - - - //--------------------------/ - //- Class/Member Variables -/ - //--------------------------/ - - /** - * The None type - */ - public static final int NONE_TYPE = 0; - - /** - * The instance of the None type - */ - public static final ColourNoValueColourType NONE = new ColourNoValueColourType(NONE_TYPE, "None"); - - /** - * The Min type - */ - public static final int MIN_TYPE = 1; - - /** - * The instance of the Min type - */ - public static final ColourNoValueColourType MIN = new ColourNoValueColourType(MIN_TYPE, "Min"); - - /** - * The Max type - */ - public static final int MAX_TYPE = 2; - - /** - * The instance of the Max type - */ - public static final ColourNoValueColourType MAX = new ColourNoValueColourType(MAX_TYPE, "Max"); - - /** - * Field _memberTable. - */ - private static java.util.Hashtable _memberTable = init(); - - /** - * Field type. - */ - private int type = -1; - - /** - * Field stringValue. - */ - private java.lang.String stringValue = null; - - - //----------------/ - //- Constructors -/ - //----------------/ - - private ColourNoValueColourType(final int type, final java.lang.String value) { - super(); - this.type = type; - this.stringValue = value; - } - - - //-----------/ - //- Methods -/ - //-----------/ - - /** - * Method enumerate.Returns an enumeration of all possible - * instances of ColourNoValueColourType - * - * @return an Enumeration over all possible instances of - * ColourNoValueColourType - */ - public static java.util.Enumeration enumerate( - ) { - return _memberTable.elements(); - } - - /** - * Method getType.Returns the type of this - * ColourNoValueColourType - * - * @return the type of this ColourNoValueColourType - */ - public int getType( - ) { - return this.type; - } - - /** - * Method init. - * - * @return the initialized Hashtable for the member table - */ - private static java.util.Hashtable init( - ) { - Hashtable members = new Hashtable(); - members.put("None", NONE); - members.put("Min", MIN); - members.put("Max", MAX); - return members; - } - - /** - * Method readResolve. will be called during deserialization to - * replace the deserialized object with the correct constant - * instance. - * - * @return this deserialized object - */ - private java.lang.Object readResolve( - ) { - return valueOf(this.stringValue); - } - - /** - * Method toString.Returns the String representation of this - * ColourNoValueColourType - * - * @return the String representation of this - * ColourNoValueColourType - */ - public java.lang.String toString( - ) { - return this.stringValue; - } - - /** - * Method valueOf.Returns a new ColourNoValueColourType based - * on the given String value. - * - * @param string - * @return the ColourNoValueColourType value of parameter - * 'string' - */ - public static jalview.binding.types.ColourNoValueColourType valueOf( - final java.lang.String string) { - java.lang.Object obj = null; - if (string != null) { - obj = _memberTable.get(string); - } - if (obj == null) { - String err = "" + string + " is not a valid ColourNoValueColourType"; - throw new IllegalArgumentException(err); - } - return (ColourNoValueColourType) obj; - } - -} diff --git a/src/jalview/binding/types/NoValueColour.java b/src/jalview/binding/types/NoValueColour.java new file mode 100644 index 0000000..c1540f6 --- /dev/null +++ b/src/jalview/binding/types/NoValueColour.java @@ -0,0 +1,169 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.binding.types; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + +import java.util.Hashtable; + +/** + * Graduated feature colour if no score (or attribute) value + * + * @version $Revision$ $Date$ + */ +public class NoValueColour implements java.io.Serializable +{ + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * The None type + */ + public static final int NONE_TYPE = 0; + + /** + * The instance of the None type + */ + public static final NoValueColour NONE = new NoValueColour(NONE_TYPE, + "None"); + + /** + * The Min type + */ + public static final int MIN_TYPE = 1; + + /** + * The instance of the Min type + */ + public static final NoValueColour MIN = new NoValueColour(MIN_TYPE, + "Min"); + + /** + * The Max type + */ + public static final int MAX_TYPE = 2; + + /** + * The instance of the Max type + */ + public static final NoValueColour MAX = new NoValueColour(MAX_TYPE, + "Max"); + + /** + * Field _memberTable. + */ + private static java.util.Hashtable _memberTable = init(); + + /** + * Field type. + */ + private int type = -1; + + /** + * Field stringValue. + */ + private java.lang.String stringValue = null; + + // ----------------/ + // - Constructors -/ + // ----------------/ + + private NoValueColour(final int type, final java.lang.String value) + { + super(); + this.type = type; + this.stringValue = value; + } + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Method enumerate.Returns an enumeration of all possible instances of + * NoValueColour + * + * @return an Enumeration over all possible instances of NoValueColour + */ + public static java.util.Enumeration enumerate() + { + return _memberTable.elements(); + } + + /** + * Method getType.Returns the type of this NoValueColour + * + * @return the type of this NoValueColour + */ + public int getType() + { + return this.type; + } + + /** + * Method init. + * + * @return the initialized Hashtable for the member table + */ + private static java.util.Hashtable init() + { + Hashtable members = new Hashtable(); + members.put("None", NONE); + members.put("Min", MIN); + members.put("Max", MAX); + return members; + } + + /** + * Method readResolve. will be called during deserialization to replace the + * deserialized object with the correct constant instance. + * + * @return this deserialized object + */ + private java.lang.Object readResolve() + { + return valueOf(this.stringValue); + } + + /** + * Method toString.Returns the String representation of this NoValueColour + * + * @return the String representation of this NoValueColour + */ + public java.lang.String toString() + { + return this.stringValue; + } + + /** + * Method valueOf.Returns a new NoValueColour based on the given String value. + * + * @param string + * @return the NoValueColour value of parameter 'string' + */ + public static jalview.binding.types.NoValueColour valueOf( + final java.lang.String string) + { + java.lang.Object obj = null; + if (string != null) + { + obj = _memberTable.get(string); + } + if (obj == null) + { + String err = "" + string + " is not a valid NoValueColour"; + throw new IllegalArgumentException(err); + } + return (NoValueColour) obj; + } + +} diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 811b377..6182885 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -22,29 +22,20 @@ package jalview.gui; import jalview.api.FeatureColourI; import jalview.api.FeatureSettingsControllerI; -import jalview.bin.Cache; import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceI; -import jalview.datamodel.features.FeatureMatcher; import jalview.datamodel.features.FeatureMatcherI; import jalview.datamodel.features.FeatureMatcherSet; import jalview.datamodel.features.FeatureMatcherSetI; import jalview.gui.Help.HelpId; import jalview.io.JalviewFileChooser; import jalview.io.JalviewFileView; -import jalview.schemabinding.version2.CompoundMatcher; import jalview.schemabinding.version2.Filter; import jalview.schemabinding.version2.JalviewUserColours; -import jalview.schemabinding.version2.MatchCondition; import jalview.schemabinding.version2.MatcherSet; -import jalview.schemabinding.version2.types.ColourNoValueColourType; -import jalview.schemabinding.version2.types.ColourThreshTypeType; -import jalview.schemabinding.version2.types.FeatureMatcherByType; import jalview.schemes.FeatureColour; -import jalview.util.Format; import jalview.util.MessageManager; import jalview.util.Platform; -import jalview.util.matcher.Condition; import jalview.viewmodel.AlignmentViewport; import jalview.viewmodel.seqfeatures.FeatureRendererModel.FeatureSettingsBean; import jalview.ws.DasSequenceFeatureFetcher; @@ -75,7 +66,6 @@ import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; -import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; @@ -189,290 +179,6 @@ public class FeatureSettings extends JPanel Map typeWidth = null; /** - * Populates an XML model of the feature colour scheme for one feature type - * - * @param featureType - * @param fcol - * @return - */ - protected static jalview.schemabinding.version2.Colour marshalColour( - String featureType, FeatureColourI fcol) - { - jalview.schemabinding.version2.Colour col = new jalview.schemabinding.version2.Colour(); - if (fcol.isSimpleColour()) - { - col.setRGB(Format.getHexString(fcol.getColour())); - } - else - { - col.setRGB(Format.getHexString(fcol.getMaxColour())); - col.setMin(fcol.getMin()); - col.setMax(fcol.getMax()); - col.setMinRGB(jalview.util.Format.getHexString(fcol.getMinColour())); - col.setAutoScale(fcol.isAutoScaled()); - col.setThreshold(fcol.getThreshold()); - col.setColourByLabel(fcol.isColourByLabel()); - col.setThreshType(fcol.isAboveThreshold() ? ColourThreshTypeType.ABOVE - : (fcol.isBelowThreshold() ? ColourThreshTypeType.BELOW - : ColourThreshTypeType.NONE)); - if (fcol.isColourByAttribute()) - { - col.setAttributeName(fcol.getAttributeName()); - } - Color noColour = fcol.getNoColour(); - if (noColour == null) - { - col.setNoValueColour(ColourNoValueColourType.NONE); - } - else if (noColour == fcol.getMaxColour()) - { - col.setNoValueColour(ColourNoValueColourType.MAX); - } - else - { - col.setNoValueColour(ColourNoValueColourType.MIN); - } - } - col.setName(featureType); - return col; - } - - /** - * Populates an XML model of the feature filter(s) for one feature type - * - * @param firstMatcher - * the first (or only) match condition) - * @param filter - * remaining match conditions (if any) - * @param and - * if true, conditions are and-ed, else or-ed - */ - protected static MatcherSet marshalFilter(FeatureMatcherI firstMatcher, - Iterator filters, boolean and) - { - MatcherSet result = new MatcherSet(); - - if (filters.hasNext()) - { - /* - * compound matcher - */ - CompoundMatcher compound = new CompoundMatcher(); - compound.setAnd(and); - MatcherSet matcher1 = marshalFilter(firstMatcher, - Collections.emptyIterator(), and); - compound.addMatcherSet(matcher1); - FeatureMatcherI nextMatcher = filters.next(); - MatcherSet matcher2 = marshalFilter(nextMatcher, filters, and); - compound.addMatcherSet(matcher2); - result.setCompoundMatcher(compound); - } - else - { - /* - * single condition matcher - */ - MatchCondition matcherModel = new MatchCondition(); - matcherModel.setCondition( - firstMatcher.getMatcher().getCondition().getStableName()); - matcherModel.setValue(firstMatcher.getMatcher().getPattern()); - if (firstMatcher.isByAttribute()) - { - matcherModel.setBy(FeatureMatcherByType.BYATTRIBUTE); - matcherModel.setAttributeName(firstMatcher.getAttribute()); - } - else if (firstMatcher.isByLabel()) - { - matcherModel.setBy(FeatureMatcherByType.BYLABEL); - } - else if (firstMatcher.isByScore()) - { - matcherModel.setBy(FeatureMatcherByType.BYSCORE); - } - result.setMatchCondition(matcherModel); - } - - return result; - } - - /** - * Loads one XML model of a feature filter to a Jalview object - * - * @param colourModel - * @return - */ - protected static FeatureMatcherSetI unmarshalFilter(Filter filterModel) - { - FeatureMatcherSetI result = new FeatureMatcherSet(); - MatcherSet matcherSetModel = filterModel.getMatcherSet(); - try - { - unmarshalFilterConditions(result, matcherSetModel, true); - } catch (IllegalStateException e) - { - // mixing AND and OR conditions perhaps - System.err.println( - String.format("Error reading filter conditions for '%s': %s", - filterModel.getFeatureType(), e.getMessage())); - // return as much as was parsed up to the error - } - - return result; - } - - /** - * Adds feature match conditions to matcherSet as unmarshalled from XML - * (possibly recursively for compound conditions) - * - * @param matcherSet - * @param matcherSetModel - * @param and - * if true, multiple conditions are AND-ed, else they are OR-ed - * @throws IllegalStateException - * if AND and OR conditions are mixed - */ - protected static void unmarshalFilterConditions( - FeatureMatcherSetI matcherSet, MatcherSet matcherSetModel, - boolean and) - { - MatchCondition mc = matcherSetModel.getMatchCondition(); - if (mc != null) - { - /* - * single condition - */ - FeatureMatcherByType filterBy = mc.getBy(); - Condition cond = Condition.fromString(mc.getCondition()); - String pattern = mc.getValue(); - FeatureMatcherI matchCondition = null; - if (filterBy == FeatureMatcherByType.BYLABEL) - { - matchCondition = FeatureMatcher.byLabel(cond, pattern); - } - else if (filterBy == FeatureMatcherByType.BYSCORE) - { - matchCondition = FeatureMatcher.byScore(cond, pattern); - - } - else if (filterBy == FeatureMatcherByType.BYATTRIBUTE) - { - String[] attNames = mc.getAttributeName(); - matchCondition = FeatureMatcher.byAttribute(cond, pattern, - attNames); - } - - /* - * note this throws IllegalStateException if AND-ing to a - * previously OR-ed compound condition, or vice versa - */ - if (and) - { - matcherSet.and(matchCondition); - } - else - { - matcherSet.or(matchCondition); - } - } - else - { - /* - * compound condition - */ - MatcherSet[] matchers = matcherSetModel.getCompoundMatcher() - .getMatcherSet(); - boolean anded = matcherSetModel.getCompoundMatcher().getAnd(); - if (matchers.length == 2) - { - unmarshalFilterConditions(matcherSet, matchers[0], anded); - unmarshalFilterConditions(matcherSet, matchers[1], anded); - } - else - { - System.err.println("Malformed compound filter condition"); - } - } - } - - /** - * Loads one XML model of a feature colour to a Jalview object - * - * @param colourModel - * @return - */ - protected static FeatureColourI unmarshalColour( - jalview.schemabinding.version2.Colour colourModel) - { - FeatureColourI colour = null; - - if (colourModel.hasMax()) - { - Color mincol = null; - Color maxcol = null; - Color noValueColour = null; - - try - { - mincol = new Color(Integer.parseInt(colourModel.getMinRGB(), 16)); - maxcol = new Color(Integer.parseInt(colourModel.getRGB(), 16)); - } catch (Exception e) - { - Cache.log.warn("Couldn't parse out graduated feature color.", e); - } - - ColourNoValueColourType noCol = colourModel.getNoValueColour(); - if (noCol == ColourNoValueColourType.MIN) - { - noValueColour = mincol; - } - else if (noCol == ColourNoValueColourType.MAX) - { - noValueColour = maxcol; - } - - colour = new FeatureColour(mincol, maxcol, noValueColour, - colourModel.getMin(), - colourModel.getMax()); - String[] attributes = colourModel.getAttributeName(); - if (attributes != null && attributes.length > 0) - { - colour.setAttributeName(attributes); - } - if (colourModel.hasAutoScale()) - { - colour.setAutoScaled(colourModel.getAutoScale()); - } - if (colourModel.hasColourByLabel()) - { - colour.setColourByLabel(colourModel.getColourByLabel()); - } - if (colourModel.hasThreshold()) - { - colour.setThreshold(colourModel.getThreshold()); - } - ColourThreshTypeType ttyp = colourModel.getThreshType(); - if (ttyp != null) - { - if (ttyp == ColourThreshTypeType.ABOVE) - { - colour.setAboveThreshold(true); - } - else if (ttyp == ColourThreshTypeType.BELOW) - { - colour.setBelowThreshold(true); - } - } - } - else - { - Color color = new Color(Integer.parseInt(colourModel.getRGB(), 16)); - colour = new FeatureColour(color); - } - - return colour; - } - - /** * Constructor * * @param af @@ -1178,7 +884,7 @@ public class FeatureSettings extends JPanel for (int i = jucs.getColourCount() - 1; i >= 0; i--) { jalview.schemabinding.version2.Colour newcol = jucs.getColour(i); - FeatureColourI colour = unmarshalColour(newcol); + FeatureColourI colour = Jalview2XML.unmarshalColour(newcol); fr.setColour(newcol.getName(), colour); fr.setOrder(newcol.getName(), i / (float) jucs.getColourCount()); } @@ -1191,10 +897,12 @@ public class FeatureSettings extends JPanel { jalview.schemabinding.version2.Filter filterModel = jucs .getFilter(i); - FeatureMatcherSetI filter = unmarshalFilter(filterModel); + String featureType = filterModel.getFeatureType(); + FeatureMatcherSetI filter = Jalview2XML.unmarshalFilter(featureType, + filterModel.getMatcherSet()); if (!filter.isEmpty()) { - fr.setFeatureFilter(filterModel.getFeatureType(), filter); + fr.setFeatureFilter(featureType, filter); } } @@ -1264,7 +972,7 @@ public class FeatureSettings extends JPanel for (String featureType : sortedTypes) { FeatureColourI fcol = fr.getFeatureStyle(featureType); - jalview.schemabinding.version2.Colour col = marshalColour( + jalview.schemabinding.version2.Colour col = Jalview2XML.marshalColour( featureType, fcol); ucs.addColour(col); } @@ -1279,7 +987,7 @@ public class FeatureSettings extends JPanel { Iterator iterator = filter.getMatchers().iterator(); FeatureMatcherI firstMatcher = iterator.next(); - MatcherSet ms = marshalFilter(firstMatcher, iterator, + MatcherSet ms = Jalview2XML.marshalFilter(firstMatcher, iterator, filter.isAnded()); Filter filterModel = new Filter(); filterModel.setFeatureType(featureType); diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 7a06d08..fdc2847 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -37,6 +37,10 @@ import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.datamodel.StructureViewerModel; import jalview.datamodel.StructureViewerModel.StructureData; +import jalview.datamodel.features.FeatureMatcher; +import jalview.datamodel.features.FeatureMatcherI; +import jalview.datamodel.features.FeatureMatcherSet; +import jalview.datamodel.features.FeatureMatcherSetI; import jalview.ext.varna.RnaModel; import jalview.gui.StructureViewer.ViewerType; import jalview.io.DataSourceType; @@ -48,6 +52,8 @@ import jalview.schemabinding.version2.Annotation; import jalview.schemabinding.version2.AnnotationColours; import jalview.schemabinding.version2.AnnotationElement; import jalview.schemabinding.version2.CalcIdParam; +import jalview.schemabinding.version2.Colour; +import jalview.schemabinding.version2.CompoundMatcher; import jalview.schemabinding.version2.DBRef; import jalview.schemabinding.version2.Features; import jalview.schemabinding.version2.Group; @@ -60,6 +66,8 @@ import jalview.schemabinding.version2.MapListFrom; import jalview.schemabinding.version2.MapListTo; import jalview.schemabinding.version2.Mapping; import jalview.schemabinding.version2.MappingChoice; +import jalview.schemabinding.version2.MatchCondition; +import jalview.schemabinding.version2.MatcherSet; import jalview.schemabinding.version2.OtherData; import jalview.schemabinding.version2.PdbentryItem; import jalview.schemabinding.version2.Pdbids; @@ -75,6 +83,9 @@ import jalview.schemabinding.version2.ThresholdLine; import jalview.schemabinding.version2.Tree; import jalview.schemabinding.version2.UserColours; import jalview.schemabinding.version2.Viewport; +import jalview.schemabinding.version2.types.ColourThreshTypeType; +import jalview.schemabinding.version2.types.FeatureMatcherByType; +import jalview.schemabinding.version2.types.NoValueColour; import jalview.schemes.AnnotationColourGradient; import jalview.schemes.ColourSchemeI; import jalview.schemes.ColourSchemeProperty; @@ -83,10 +94,12 @@ import jalview.schemes.ResidueProperties; import jalview.schemes.UserColourScheme; import jalview.structure.StructureSelectionManager; import jalview.structures.models.AAStructureBindingModel; +import jalview.util.Format; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.util.StringUtils; import jalview.util.jarInputStreamProvider; +import jalview.util.matcher.Condition; import jalview.viewmodel.AlignmentViewport; import jalview.viewmodel.ViewportRanges; import jalview.viewmodel.seqfeatures.FeatureRendererSettings; @@ -115,6 +128,7 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; @@ -1331,19 +1345,33 @@ public class Jalview2XML { jalview.schemabinding.version2.FeatureSettings fs = new jalview.schemabinding.version2.FeatureSettings(); - String[] renderOrder = ap.getSeqPanel().seqCanvas - .getFeatureRenderer().getRenderOrder() - .toArray(new String[0]); + FeatureRenderer fr = ap.getSeqPanel().seqCanvas + .getFeatureRenderer(); + String[] renderOrder = fr.getRenderOrder().toArray(new String[0]); Vector settingsAdded = new Vector<>(); if (renderOrder != null) { for (String featureType : renderOrder) { - FeatureColourI fcol = ap.getSeqPanel().seqCanvas - .getFeatureRenderer().getFeatureStyle(featureType); Setting setting = new Setting(); setting.setType(featureType); + + /* + * save any filter for the feature type + */ + FeatureMatcherSetI filter = fr.getFeatureFilter(featureType); + if (filter != null) { + Iterator filters = filter.getMatchers().iterator(); + FeatureMatcherI firstFilter = filters.next(); + setting.setMatcherSet(Jalview2XML.marshalFilter( + firstFilter, filters, filter.isAnded())); + } + + /* + * save colour scheme for the feature type + */ + FeatureColourI fcol = fr.getFeatureStyle(featureType); if (!fcol.isSimpleColour()) { setting.setColour(fcol.getMaxColour().getRGB()); @@ -1351,8 +1379,25 @@ public class Jalview2XML setting.setMin(fcol.getMin()); setting.setMax(fcol.getMax()); setting.setColourByLabel(fcol.isColourByLabel()); + if (fcol.isColourByAttribute()) + { + setting.setAttributeName(fcol.getAttributeName()); + } setting.setAutoScale(fcol.isAutoScaled()); setting.setThreshold(fcol.getThreshold()); + Color noColour = fcol.getNoColour(); + if (noColour == null) + { + setting.setNoValueColour(NoValueColour.NONE); + } + else if (noColour.equals(fcol.getMaxColour())) + { + setting.setNoValueColour(NoValueColour.MAX); + } + else + { + setting.setNoValueColour(NoValueColour.MIN); + } // -1 = No threshold, 0 = Below, 1 = Above setting.setThreshstate(fcol.isAboveThreshold() ? 1 : (fcol.isBelowThreshold() ? 0 : -1)); @@ -1364,7 +1409,7 @@ public class Jalview2XML setting.setDisplay( av.getFeaturesDisplayed().isVisible(featureType)); - float rorder = ap.getSeqPanel().seqCanvas.getFeatureRenderer() + float rorder = fr .getOrder(featureType); if (rorder > -1) { @@ -1376,8 +1421,7 @@ public class Jalview2XML } // is groups actually supposed to be a map here ? - Iterator en = ap.getSeqPanel().seqCanvas - .getFeatureRenderer().getFeatureGroups().iterator(); + Iterator en = fr.getFeatureGroups().iterator(); Vector groupsAdded = new Vector<>(); while (en.hasNext()) { @@ -1388,8 +1432,7 @@ public class Jalview2XML } Group g = new Group(); g.setName(grp); - g.setDisplay(((Boolean) ap.getSeqPanel().seqCanvas - .getFeatureRenderer().checkGroupVisibility(grp, false)) + g.setDisplay(((Boolean) fr.checkGroupVisibility(grp, false)) .booleanValue()); fs.addGroup(g); groupsAdded.addElement(grp); @@ -4595,9 +4638,11 @@ public class Jalview2XML af.viewport.setShowGroupConservation(false); } - // recover featre settings + // recover feature settings if (jms.getFeatureSettings() != null) { + FeatureRenderer fr = af.alignPanel.getSeqPanel().seqCanvas + .getFeatureRenderer(); FeaturesDisplayed fdi; af.viewport.setFeaturesDisplayed(fdi = new FeaturesDisplayed()); String[] renderOrder = new String[jms.getFeatureSettings() @@ -4609,14 +4654,51 @@ public class Jalview2XML .getSettingCount(); fs++) { Setting setting = jms.getFeatureSettings().getSetting(fs); + String featureType = setting.getType(); + + /* + * restore feature filters (if any) + */ + MatcherSet filters = setting.getMatcherSet(); + if (filters != null) + { + FeatureMatcherSetI filter = Jalview2XML + .unmarshalFilter(featureType, filters); + if (!filter.isEmpty()) + { + fr.setFeatureFilter(featureType, filter); + } + } + + /* + * restore feature colour scheme + */ + Color maxColour = new Color(setting.getColour()); if (setting.hasMincolour()) { - FeatureColourI gc = setting.hasMin() - ? new FeatureColour(new Color(setting.getMincolour()), - new Color(setting.getColour()), setting.getMin(), - setting.getMax()) - : new FeatureColour(new Color(setting.getMincolour()), - new Color(setting.getColour()), 0, 1); + /* + * minColour is always set unless a simple colour + * (including for colour by label though it doesn't use it) + */ + Color minColour = new Color(setting.getMincolour()); + Color noValueColour = minColour; + NoValueColour noColour = setting.getNoValueColour(); + if (noColour == NoValueColour.NONE) + { + noValueColour = null; + } + else if (noColour == NoValueColour.MAX) + { + noValueColour = maxColour; + } + float min = setting.hasMin() ? setting.getMin() : 0f; + float max = setting.hasMin() ? setting.getMax() : 1f; + FeatureColourI gc = new FeatureColour(minColour, maxColour, + noValueColour, min, max); + if (setting.getAttributeNameCount() > 0) + { + gc.setAttributeName(setting.getAttributeName()); + } if (setting.hasThreshold()) { gc.setThreshold(setting.getThreshold()); @@ -4641,26 +4723,26 @@ public class Jalview2XML gc.setColourByLabel(setting.getColourByLabel()); } // and put in the feature colour table. - featureColours.put(setting.getType(), gc); + featureColours.put(featureType, gc); } else { - featureColours.put(setting.getType(), - new FeatureColour(new Color(setting.getColour()))); + featureColours.put(featureType, + new FeatureColour(maxColour)); } - renderOrder[fs] = setting.getType(); + renderOrder[fs] = featureType; if (setting.hasOrder()) { - featureOrder.put(setting.getType(), setting.getOrder()); + featureOrder.put(featureType, setting.getOrder()); } else { - featureOrder.put(setting.getType(), new Float( + featureOrder.put(featureType, new Float( fs / jms.getFeatureSettings().getSettingCount())); } if (setting.getDisplay()) { - fdi.setVisible(setting.getType()); + fdi.setVisible(featureType); } } Map fgtable = new Hashtable<>(); @@ -4674,9 +4756,7 @@ public class Jalview2XML // jms.getFeatureSettings().getTransparency() : 0.0, featureOrder); FeatureRendererSettings frs = new FeatureRendererSettings(renderOrder, fgtable, featureColours, 1.0f, featureOrder); - af.alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer() - .transferSettings(frs); - + fr.transferSettings(frs); } if (view.getHiddenColumnsCount() > 0) @@ -5630,4 +5710,289 @@ public class Jalview2XML { return counter++; } + + /** + * Populates an XML model of the feature colour scheme for one feature type + * + * @param featureType + * @param fcol + * @return + */ + protected static jalview.schemabinding.version2.Colour marshalColour( + String featureType, FeatureColourI fcol) + { + jalview.schemabinding.version2.Colour col = new jalview.schemabinding.version2.Colour(); + if (fcol.isSimpleColour()) + { + col.setRGB(Format.getHexString(fcol.getColour())); + } + else + { + col.setRGB(Format.getHexString(fcol.getMaxColour())); + col.setMin(fcol.getMin()); + col.setMax(fcol.getMax()); + col.setMinRGB(jalview.util.Format.getHexString(fcol.getMinColour())); + col.setAutoScale(fcol.isAutoScaled()); + col.setThreshold(fcol.getThreshold()); + col.setColourByLabel(fcol.isColourByLabel()); + col.setThreshType(fcol.isAboveThreshold() ? ColourThreshTypeType.ABOVE + : (fcol.isBelowThreshold() ? ColourThreshTypeType.BELOW + : ColourThreshTypeType.NONE)); + if (fcol.isColourByAttribute()) + { + col.setAttributeName(fcol.getAttributeName()); + } + Color noColour = fcol.getNoColour(); + if (noColour == null) + { + col.setNoValueColour(NoValueColour.NONE); + } + else if (noColour == fcol.getMaxColour()) + { + col.setNoValueColour(NoValueColour.MAX); + } + else + { + col.setNoValueColour(NoValueColour.MIN); + } + } + col.setName(featureType); + return col; + } + + /** + * Populates an XML model of the feature filter(s) for one feature type + * + * @param firstMatcher + * the first (or only) match condition) + * @param filter + * remaining match conditions (if any) + * @param and + * if true, conditions are and-ed, else or-ed + */ + protected static MatcherSet marshalFilter(FeatureMatcherI firstMatcher, + Iterator filters, boolean and) + { + MatcherSet result = new MatcherSet(); + + if (filters.hasNext()) + { + /* + * compound matcher + */ + CompoundMatcher compound = new CompoundMatcher(); + compound.setAnd(and); + MatcherSet matcher1 = marshalFilter(firstMatcher, + Collections.emptyIterator(), and); + compound.addMatcherSet(matcher1); + FeatureMatcherI nextMatcher = filters.next(); + MatcherSet matcher2 = marshalFilter(nextMatcher, filters, and); + compound.addMatcherSet(matcher2); + result.setCompoundMatcher(compound); + } + else + { + /* + * single condition matcher + */ + MatchCondition matcherModel = new MatchCondition(); + matcherModel.setCondition( + firstMatcher.getMatcher().getCondition().getStableName()); + matcherModel.setValue(firstMatcher.getMatcher().getPattern()); + if (firstMatcher.isByAttribute()) + { + matcherModel.setBy(FeatureMatcherByType.BYATTRIBUTE); + matcherModel.setAttributeName(firstMatcher.getAttribute()); + } + else if (firstMatcher.isByLabel()) + { + matcherModel.setBy(FeatureMatcherByType.BYLABEL); + } + else if (firstMatcher.isByScore()) + { + matcherModel.setBy(FeatureMatcherByType.BYSCORE); + } + result.setMatchCondition(matcherModel); + } + + return result; + } + + /** + * Loads one XML model of a feature filter to a Jalview object + * + * @param featureType + * @param matcherSetModel + * @return + */ + protected static FeatureMatcherSetI unmarshalFilter( + String featureType, MatcherSet matcherSetModel) + { + FeatureMatcherSetI result = new FeatureMatcherSet(); + try + { + unmarshalFilterConditions(result, matcherSetModel, true); + } catch (IllegalStateException e) + { + // mixing AND and OR conditions perhaps + System.err.println( + String.format("Error reading filter conditions for '%s': %s", + featureType, e.getMessage())); + // return as much as was parsed up to the error + } + + return result; + } + + /** + * Adds feature match conditions to matcherSet as unmarshalled from XML + * (possibly recursively for compound conditions) + * + * @param matcherSet + * @param matcherSetModel + * @param and + * if true, multiple conditions are AND-ed, else they are OR-ed + * @throws IllegalStateException + * if AND and OR conditions are mixed + */ + protected static void unmarshalFilterConditions( + FeatureMatcherSetI matcherSet, MatcherSet matcherSetModel, + boolean and) + { + MatchCondition mc = matcherSetModel.getMatchCondition(); + if (mc != null) + { + /* + * single condition + */ + FeatureMatcherByType filterBy = mc.getBy(); + Condition cond = Condition.fromString(mc.getCondition()); + String pattern = mc.getValue(); + FeatureMatcherI matchCondition = null; + if (filterBy == FeatureMatcherByType.BYLABEL) + { + matchCondition = FeatureMatcher.byLabel(cond, pattern); + } + else if (filterBy == FeatureMatcherByType.BYSCORE) + { + matchCondition = FeatureMatcher.byScore(cond, pattern); + + } + else if (filterBy == FeatureMatcherByType.BYATTRIBUTE) + { + String[] attNames = mc.getAttributeName(); + matchCondition = FeatureMatcher.byAttribute(cond, pattern, + attNames); + } + + /* + * note this throws IllegalStateException if AND-ing to a + * previously OR-ed compound condition, or vice versa + */ + if (and) + { + matcherSet.and(matchCondition); + } + else + { + matcherSet.or(matchCondition); + } + } + else + { + /* + * compound condition + */ + MatcherSet[] matchers = matcherSetModel.getCompoundMatcher() + .getMatcherSet(); + boolean anded = matcherSetModel.getCompoundMatcher().getAnd(); + if (matchers.length == 2) + { + unmarshalFilterConditions(matcherSet, matchers[0], anded); + unmarshalFilterConditions(matcherSet, matchers[1], anded); + } + else + { + System.err.println("Malformed compound filter condition"); + } + } + } + + /** + * Loads one XML model of a feature colour to a Jalview object + * + * @param colourModel + * @return + */ + protected static FeatureColourI unmarshalColour( + jalview.schemabinding.version2.Colour colourModel) + { + FeatureColourI colour = null; + + if (colourModel.hasMax()) + { + Color mincol = null; + Color maxcol = null; + Color noValueColour = null; + + try + { + mincol = new Color(Integer.parseInt(colourModel.getMinRGB(), 16)); + maxcol = new Color(Integer.parseInt(colourModel.getRGB(), 16)); + } catch (Exception e) + { + Cache.log.warn("Couldn't parse out graduated feature color.", e); + } + + NoValueColour noCol = colourModel.getNoValueColour(); + if (noCol == NoValueColour.MIN) + { + noValueColour = mincol; + } + else if (noCol == NoValueColour.MAX) + { + noValueColour = maxcol; + } + + colour = new FeatureColour(mincol, maxcol, noValueColour, + colourModel.getMin(), + colourModel.getMax()); + String[] attributes = colourModel.getAttributeName(); + if (attributes != null && attributes.length > 0) + { + colour.setAttributeName(attributes); + } + if (colourModel.hasAutoScale()) + { + colour.setAutoScaled(colourModel.getAutoScale()); + } + if (colourModel.hasColourByLabel()) + { + colour.setColourByLabel(colourModel.getColourByLabel()); + } + if (colourModel.hasThreshold()) + { + colour.setThreshold(colourModel.getThreshold()); + } + ColourThreshTypeType ttyp = colourModel.getThreshType(); + if (ttyp != null) + { + if (ttyp == ColourThreshTypeType.ABOVE) + { + colour.setAboveThreshold(true); + } + else if (ttyp == ColourThreshTypeType.BELOW) + { + colour.setBelowThreshold(true); + } + } + } + else + { + Color color = new Color(Integer.parseInt(colourModel.getRGB(), 16)); + colour = new FeatureColour(color); + } + + return colour; + } } diff --git a/src/jalview/schemabinding/version2/Colour.java b/src/jalview/schemabinding/version2/Colour.java index 8f709d7..d1c7297 100644 --- a/src/jalview/schemabinding/version2/Colour.java +++ b/src/jalview/schemabinding/version2/Colour.java @@ -43,9 +43,9 @@ public class Colour implements java.io.Serializable private java.lang.String _minRGB; /** - * Colour if no attribute or score value + * Field _noValueColour. */ - private jalview.schemabinding.version2.types.ColourNoValueColourType _noValueColour = jalview.schemabinding.version2.types.ColourNoValueColourType + private jalview.schemabinding.version2.types.NoValueColour _noValueColour = jalview.schemabinding.version2.types.NoValueColour .valueOf("Min"); /** @@ -115,9 +115,8 @@ public class Colour implements java.io.Serializable public Colour() { super(); - setNoValueColour( - jalview.schemabinding.version2.types.ColourNoValueColourType - .valueOf("Min")); + setNoValueColour(jalview.schemabinding.version2.types.NoValueColour + .valueOf("Min")); this._attributeNameList = new java.util.Vector(); } @@ -322,12 +321,11 @@ public class Colour implements java.io.Serializable } /** - * Returns the value of field 'noValueColour'. The field 'noValueColour' has - * the following description: Colour if no attribute or score value + * Returns the value of field 'noValueColour'. * * @return the value of field 'NoValueColour'. */ - public jalview.schemabinding.version2.types.ColourNoValueColourType getNoValueColour() + public jalview.schemabinding.version2.types.NoValueColour getNoValueColour() { return this._noValueColour; } @@ -629,14 +627,13 @@ public class Colour implements java.io.Serializable } /** - * Sets the value of field 'noValueColour'. The field 'noValueColour' has the - * following description: Colour if no attribute or score value + * Sets the value of field 'noValueColour'. * * @param noValueColour * the value of field 'noValueColour'. */ public void setNoValueColour( - final jalview.schemabinding.version2.types.ColourNoValueColourType noValueColour) + final jalview.schemabinding.version2.types.NoValueColour noValueColour) { this._noValueColour = noValueColour; } diff --git a/src/jalview/schemabinding/version2/FeatureMatcherSet.java b/src/jalview/schemabinding/version2/FeatureMatcherSet.java index 893a30d..2d79a98 100644 --- a/src/jalview/schemabinding/version2/FeatureMatcherSet.java +++ b/src/jalview/schemabinding/version2/FeatureMatcherSet.java @@ -34,12 +34,12 @@ public class FeatureMatcherSet implements java.io.Serializable /** * Field _matchCondition. */ - private jalview.schemabinding.version2.MatchCondition _matchCondition; + private MatchCondition _matchCondition; /** * Field _compoundMatcher. */ - private jalview.schemabinding.version2.CompoundMatcher _compoundMatcher; + private CompoundMatcher _compoundMatcher; // ----------------/ // - Constructors -/ @@ -70,7 +70,7 @@ public class FeatureMatcherSet implements java.io.Serializable * * @return the value of field 'CompoundMatcher'. */ - public jalview.schemabinding.version2.CompoundMatcher getCompoundMatcher() + public CompoundMatcher getCompoundMatcher() { return this._compoundMatcher; } @@ -80,7 +80,7 @@ public class FeatureMatcherSet implements java.io.Serializable * * @return the value of field 'MatchCondition'. */ - public jalview.schemabinding.version2.MatchCondition getMatchCondition() + public MatchCondition getMatchCondition() { return this._matchCondition; } @@ -145,8 +145,7 @@ public class FeatureMatcherSet implements java.io.Serializable * @param compoundMatcher * the value of field 'compoundMatcher'. */ - public void setCompoundMatcher( - final jalview.schemabinding.version2.CompoundMatcher compoundMatcher) + public void setCompoundMatcher(final CompoundMatcher compoundMatcher) { this._compoundMatcher = compoundMatcher; this._choiceValue = compoundMatcher; @@ -158,8 +157,7 @@ public class FeatureMatcherSet implements java.io.Serializable * @param matchCondition * the value of field 'matchCondition'. */ - public void setMatchCondition( - final jalview.schemabinding.version2.MatchCondition matchCondition) + public void setMatchCondition(final MatchCondition matchCondition) { this._matchCondition = matchCondition; this._choiceValue = matchCondition; diff --git a/src/jalview/schemabinding/version2/MatcherSet.java b/src/jalview/schemabinding/version2/MatcherSet.java index fa7fd71..6fde9e4 100644 --- a/src/jalview/schemabinding/version2/MatcherSet.java +++ b/src/jalview/schemabinding/version2/MatcherSet.java @@ -15,7 +15,7 @@ import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; /** - * Class MatcherSet. + * optional filter(s) applied to the feature type * * @version $Revision$ $Date$ */ diff --git a/src/jalview/schemabinding/version2/Setting.java b/src/jalview/schemabinding/version2/Setting.java index c458971..59e9522 100644 --- a/src/jalview/schemabinding/version2/Setting.java +++ b/src/jalview/schemabinding/version2/Setting.java @@ -73,6 +73,12 @@ public class Setting implements java.io.Serializable private boolean _has_mincolour; /** + * Field _noValueColour. + */ + private jalview.schemabinding.version2.types.NoValueColour _noValueColour = jalview.schemabinding.version2.types.NoValueColour + .valueOf("Min"); + + /** * threshold value for graduated feature colour * */ @@ -134,6 +140,16 @@ public class Setting implements java.io.Serializable */ private boolean _has_autoScale; + /** + * name of feature attribute to colour by, or attribute and sub-attribute + */ + private java.util.Vector _attributeNameList; + + /** + * optional filter(s) applied to the feature type + */ + private jalview.schemabinding.version2.MatcherSet _matcherSet; + // ----------------/ // - Constructors -/ // ----------------/ @@ -141,6 +157,9 @@ public class Setting implements java.io.Serializable public Setting() { super(); + setNoValueColour(jalview.schemabinding.version2.types.NoValueColour + .valueOf("Min")); + this._attributeNameList = new java.util.Vector(); } // -----------/ @@ -148,76 +167,175 @@ public class Setting implements java.io.Serializable // -----------/ /** - */ + * + * + * @param vAttributeName + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + */ + public void addAttributeName(final java.lang.String vAttributeName) + throws java.lang.IndexOutOfBoundsException + { + // check for the maximum size + if (this._attributeNameList.size() >= 2) + { + throw new IndexOutOfBoundsException( + "addAttributeName has a maximum of 2"); + } + + this._attributeNameList.addElement(vAttributeName); + } + + /** + * + * + * @param index + * @param vAttributeName + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + */ + public void addAttributeName(final int index, + final java.lang.String vAttributeName) + throws java.lang.IndexOutOfBoundsException + { + // check for the maximum size + if (this._attributeNameList.size() >= 2) + { + throw new IndexOutOfBoundsException( + "addAttributeName has a maximum of 2"); + } + + this._attributeNameList.add(index, vAttributeName); + } + + /** + */ public void deleteAutoScale() { this._has_autoScale = false; } /** - */ + */ public void deleteColour() { this._has_colour = false; } /** - */ + */ public void deleteColourByLabel() { this._has_colourByLabel = false; } /** - */ + */ public void deleteDisplay() { this._has_display = false; } /** - */ + */ public void deleteMax() { this._has_max = false; } /** - */ + */ public void deleteMin() { this._has_min = false; } /** - */ + */ public void deleteMincolour() { this._has_mincolour = false; } /** - */ + */ public void deleteOrder() { this._has_order = false; } /** - */ + */ public void deleteThreshold() { this._has_threshold = false; } /** - */ + */ public void deleteThreshstate() { this._has_threshstate = false; } /** + * Method enumerateAttributeName. + * + * @return an Enumeration over all java.lang.String elements + */ + public java.util.Enumeration enumerateAttributeName() + { + return this._attributeNameList.elements(); + } + + /** + * Method getAttributeName. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + * @return the value of the java.lang.String at the given index + */ + public java.lang.String getAttributeName(final int index) + throws java.lang.IndexOutOfBoundsException + { + // check bounds for index + if (index < 0 || index >= this._attributeNameList.size()) + { + throw new IndexOutOfBoundsException("getAttributeName: Index value '" + + index + "' not in range [0.." + + (this._attributeNameList.size() - 1) + "]"); + } + + return (java.lang.String) _attributeNameList.get(index); + } + + /** + * Method getAttributeName.Returns the contents of the collection in an Array. + *

+ * Note: Just in case the collection contents are changing in another thread, + * we pass a 0-length Array of the correct type into the API call. This way we + * know that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public java.lang.String[] getAttributeName() + { + java.lang.String[] array = new java.lang.String[0]; + return (java.lang.String[]) this._attributeNameList.toArray(array); + } + + /** + * Method getAttributeNameCount. + * + * @return the size of this collection + */ + public int getAttributeNameCount() + { + return this._attributeNameList.size(); + } + + /** * Returns the value of field 'autoScale'. * * @return the value of field 'AutoScale'. @@ -258,6 +376,17 @@ public class Setting implements java.io.Serializable } /** + * Returns the value of field 'matcherSet'. The field 'matcherSet' has the + * following description: optional filter(s) applied to the feature type + * + * @return the value of field 'MatcherSet'. + */ + public jalview.schemabinding.version2.MatcherSet getMatcherSet() + { + return this._matcherSet; + } + + /** * Returns the value of field 'max'. * * @return the value of field 'Max'. @@ -290,6 +419,16 @@ public class Setting implements java.io.Serializable } /** + * Returns the value of field 'noValueColour'. + * + * @return the value of field 'NoValueColour'. + */ + public jalview.schemabinding.version2.types.NoValueColour getNoValueColour() + { + return this._noValueColour; + } + + /** * Returns the value of field 'order'. * * @return the value of field 'Order'. @@ -518,6 +657,76 @@ public class Setting implements java.io.Serializable } /** + */ + public void removeAllAttributeName() + { + this._attributeNameList.clear(); + } + + /** + * Method removeAttributeName. + * + * @param vAttributeName + * @return true if the object was removed from the collection. + */ + public boolean removeAttributeName(final java.lang.String vAttributeName) + { + boolean removed = _attributeNameList.remove(vAttributeName); + return removed; + } + + /** + * Method removeAttributeNameAt. + * + * @param index + * @return the element removed from the collection + */ + public java.lang.String removeAttributeNameAt(final int index) + { + java.lang.Object obj = this._attributeNameList.remove(index); + return (java.lang.String) obj; + } + + /** + * + * + * @param index + * @param vAttributeName + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + */ + public void setAttributeName(final int index, + final java.lang.String vAttributeName) + throws java.lang.IndexOutOfBoundsException + { + // check bounds for index + if (index < 0 || index >= this._attributeNameList.size()) + { + throw new IndexOutOfBoundsException("setAttributeName: Index value '" + + index + "' not in range [0.." + + (this._attributeNameList.size() - 1) + "]"); + } + + this._attributeNameList.set(index, vAttributeName); + } + + /** + * + * + * @param vAttributeNameArray + */ + public void setAttributeName(final java.lang.String[] vAttributeNameArray) + { + // -- copy array + _attributeNameList.clear(); + + for (int i = 0; i < vAttributeNameArray.length; i++) + { + this._attributeNameList.add(vAttributeNameArray[i]); + } + } + + /** * Sets the value of field 'autoScale'. * * @param autoScale @@ -566,6 +775,19 @@ public class Setting implements java.io.Serializable } /** + * Sets the value of field 'matcherSet'. The field 'matcherSet' has the + * following description: optional filter(s) applied to the feature type + * + * @param matcherSet + * the value of field 'matcherSet'. + */ + public void setMatcherSet( + final jalview.schemabinding.version2.MatcherSet matcherSet) + { + this._matcherSet = matcherSet; + } + + /** * Sets the value of field 'max'. * * @param max @@ -604,6 +826,18 @@ public class Setting implements java.io.Serializable } /** + * Sets the value of field 'noValueColour'. + * + * @param noValueColour + * the value of field 'noValueColour'. + */ + public void setNoValueColour( + final jalview.schemabinding.version2.types.NoValueColour noValueColour) + { + this._noValueColour = noValueColour; + } + + /** * Sets the value of field 'order'. * * @param order diff --git a/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java b/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java index eb94047..cca4ef1 100644 --- a/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java @@ -202,7 +202,7 @@ public class ColourDescriptor desc.setValidator(fieldValidator); // -- _noValueColour desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - jalview.schemabinding.version2.types.ColourNoValueColourType.class, + jalview.schemabinding.version2.types.NoValueColour.class, "_noValueColour", "noValueColour", org.exolab.castor.xml.NodeType.Attribute); handler = new org.exolab.castor.xml.XMLFieldHandler() @@ -221,7 +221,7 @@ public class ColourDescriptor { Colour target = (Colour) object; target.setNoValueColour( - (jalview.schemabinding.version2.types.ColourNoValueColourType) value); + (jalview.schemabinding.version2.types.NoValueColour) value); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); @@ -234,7 +234,7 @@ public class ColourDescriptor } }; handler = new org.exolab.castor.xml.handlers.EnumFieldHandler( - jalview.schemabinding.version2.types.ColourNoValueColourType.class, + jalview.schemabinding.version2.types.NoValueColour.class, handler); desc.setImmutable(true); desc.setHandler(handler); diff --git a/src/jalview/schemabinding/version2/descriptors/FeatureMatcherSetDescriptor.java b/src/jalview/schemabinding/version2/descriptors/FeatureMatcherSetDescriptor.java index 0584eec..b3d19bb 100644 --- a/src/jalview/schemabinding/version2/descriptors/FeatureMatcherSetDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/FeatureMatcherSetDescriptor.java @@ -7,11 +7,14 @@ package jalview.schemabinding.version2.descriptors; +import jalview.schemabinding.version2.CompoundMatcher; + //---------------------------------/ //- Imported classes and packages -/ //---------------------------------/ import jalview.schemabinding.version2.FeatureMatcherSet; +import jalview.schemabinding.version2.MatchCondition; /** * Class FeatureMatcherSetDescriptor. @@ -68,11 +71,11 @@ public class FeatureMatcherSetDescriptor // -- _matchCondition desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - jalview.schemabinding.version2.MatchCondition.class, - "_matchCondition", "matchCondition", + MatchCondition.class, "_matchCondition", "matchCondition", org.exolab.castor.xml.NodeType.Element); handler = new org.exolab.castor.xml.XMLFieldHandler() { + @Override public java.lang.Object getValue(java.lang.Object object) throws IllegalStateException { @@ -80,23 +83,24 @@ public class FeatureMatcherSetDescriptor return target.getMatchCondition(); } + @Override public void setValue(java.lang.Object object, java.lang.Object value) throws IllegalStateException, IllegalArgumentException { try { FeatureMatcherSet target = (FeatureMatcherSet) object; - target.setMatchCondition( - (jalview.schemabinding.version2.MatchCondition) value); + target.setMatchCondition((MatchCondition) value); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); } } + @Override public java.lang.Object newInstance(java.lang.Object parent) { - return new jalview.schemabinding.version2.MatchCondition(); + return new MatchCondition(); } }; desc.setHandler(handler); @@ -112,11 +116,11 @@ public class FeatureMatcherSetDescriptor desc.setValidator(fieldValidator); // -- _compoundMatcher desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - jalview.schemabinding.version2.CompoundMatcher.class, - "_compoundMatcher", "compoundMatcher", + CompoundMatcher.class, "_compoundMatcher", "compoundMatcher", org.exolab.castor.xml.NodeType.Element); handler = new org.exolab.castor.xml.XMLFieldHandler() { + @Override public java.lang.Object getValue(java.lang.Object object) throws IllegalStateException { @@ -124,23 +128,24 @@ public class FeatureMatcherSetDescriptor return target.getCompoundMatcher(); } + @Override public void setValue(java.lang.Object object, java.lang.Object value) throws IllegalStateException, IllegalArgumentException { try { FeatureMatcherSet target = (FeatureMatcherSet) object; - target.setCompoundMatcher( - (jalview.schemabinding.version2.CompoundMatcher) value); + target.setCompoundMatcher((CompoundMatcher) value); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); } } + @Override public java.lang.Object newInstance(java.lang.Object parent) { - return new jalview.schemabinding.version2.CompoundMatcher(); + return new CompoundMatcher(); } }; desc.setHandler(handler); @@ -165,6 +170,7 @@ public class FeatureMatcherSetDescriptor * * @return the access mode specified for this class. */ + @Override public org.exolab.castor.mapping.AccessMode getAccessMode() { return null; @@ -175,6 +181,7 @@ public class FeatureMatcherSetDescriptor * * @return the identity field, null if this class has no identity. */ + @Override public org.exolab.castor.mapping.FieldDescriptor getIdentity() { return super.getIdentity(); @@ -185,6 +192,7 @@ public class FeatureMatcherSetDescriptor * * @return the Java class represented by this descriptor. */ + @Override public java.lang.Class getJavaClass() { return jalview.schemabinding.version2.FeatureMatcherSet.class; @@ -195,6 +203,7 @@ public class FeatureMatcherSetDescriptor * * @return the namespace prefix to use when marshaling as XML. */ + @Override public java.lang.String getNameSpacePrefix() { return _nsPrefix; @@ -205,6 +214,7 @@ public class FeatureMatcherSetDescriptor * * @return the namespace URI used when marshaling and unmarshaling as XML. */ + @Override public java.lang.String getNameSpaceURI() { return _nsURI; @@ -216,6 +226,7 @@ public class FeatureMatcherSetDescriptor * @return a specific validator for the class described by this * ClassDescriptor. */ + @Override public org.exolab.castor.xml.TypeValidator getValidator() { return this; @@ -226,6 +237,7 @@ public class FeatureMatcherSetDescriptor * * @return the XML Name for the Class being described. */ + @Override public java.lang.String getXMLName() { return _xmlName; @@ -237,6 +249,7 @@ public class FeatureMatcherSetDescriptor * @return true if XML schema definition of this Class is that of a global * element or element with anonymous type definition. */ + @Override public boolean isElementDefinition() { return _elementDefinition; diff --git a/src/jalview/schemabinding/version2/descriptors/SettingDescriptor.java b/src/jalview/schemabinding/version2/descriptors/SettingDescriptor.java index 4703f46..c816e43 100644 --- a/src/jalview/schemabinding/version2/descriptors/SettingDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/SettingDescriptor.java @@ -18,8 +18,8 @@ import jalview.schemabinding.version2.Setting; * * @version $Revision$ $Date$ */ -public class SettingDescriptor extends - org.exolab.castor.xml.util.XMLClassDescriptorImpl +public class SettingDescriptor + extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { // --------------------------/ @@ -56,6 +56,9 @@ public class SettingDescriptor extends _nsURI = "www.jalview.org"; _xmlName = "setting"; _elementDefinition = true; + + // -- set grouping compositor + setCompositorAsSequence(); org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; org.exolab.castor.mapping.FieldHandler handler = null; org.exolab.castor.xml.FieldValidator fieldValidator = null; @@ -331,6 +334,52 @@ public class SettingDescriptor extends typeValidator.setMaxInclusive(2147483647); } desc.setValidator(fieldValidator); + // -- _noValueColour + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( + jalview.schemabinding.version2.types.NoValueColour.class, + "_noValueColour", "noValueColour", + org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() + { + public java.lang.Object getValue(java.lang.Object object) + throws IllegalStateException + { + Setting target = (Setting) object; + return target.getNoValueColour(); + } + + public void setValue(java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try + { + Setting target = (Setting) object; + target.setNoValueColour( + (jalview.schemabinding.version2.types.NoValueColour) value); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + public java.lang.Object newInstance(java.lang.Object parent) + { + return null; + } + }; + handler = new org.exolab.castor.xml.handlers.EnumFieldHandler( + jalview.schemabinding.version2.types.NoValueColour.class, + handler); + desc.setImmutable(true); + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + // -- validation code for: _noValueColour + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { // -- local scope + } + desc.setValidator(fieldValidator); // -- _threshold desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( java.lang.Float.TYPE, "_threshold", "threshold", @@ -581,8 +630,8 @@ public class SettingDescriptor extends target.deleteColourByLabel(); return; } - target.setColourByLabel(((java.lang.Boolean) value) - .booleanValue()); + target.setColourByLabel( + ((java.lang.Boolean) value).booleanValue()); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); @@ -662,6 +711,109 @@ public class SettingDescriptor extends desc.setValidator(fieldValidator); // -- initialize element descriptors + // -- _attributeNameList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( + java.lang.String.class, "_attributeNameList", "attributeName", + org.exolab.castor.xml.NodeType.Element); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() + { + public java.lang.Object getValue(java.lang.Object object) + throws IllegalStateException + { + Setting target = (Setting) object; + return target.getAttributeName(); + } + + public void setValue(java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try + { + Setting target = (Setting) object; + target.addAttributeName((java.lang.String) value); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + public void resetValue(Object object) + throws IllegalStateException, IllegalArgumentException + { + try + { + Setting target = (Setting) object; + target.removeAllAttributeName(); + } 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.setNameSpaceURI("www.jalview.org"); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + // -- validation code for: _attributeNameList + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(0); + fieldValidator.setMaxOccurs(2); + { // -- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); + // -- _matcherSet + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( + jalview.schemabinding.version2.MatcherSet.class, "_matcherSet", + "matcherSet", org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() + { + public java.lang.Object getValue(java.lang.Object object) + throws IllegalStateException + { + Setting target = (Setting) object; + return target.getMatcherSet(); + } + + public void setValue(java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try + { + Setting target = (Setting) object; + target.setMatcherSet( + (jalview.schemabinding.version2.MatcherSet) value); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + public java.lang.Object newInstance(java.lang.Object parent) + { + return new jalview.schemabinding.version2.MatcherSet(); + } + }; + desc.setHandler(handler); + desc.setNameSpaceURI("www.jalview.org"); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + // -- validation code for: _matcherSet + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { // -- local scope + } + desc.setValidator(fieldValidator); } // -----------/ diff --git a/src/jalview/schemabinding/version2/types/.castor.cdr b/src/jalview/schemabinding/version2/types/.castor.cdr index 5735fcc..d9874b6 100644 --- a/src/jalview/schemabinding/version2/types/.castor.cdr +++ b/src/jalview/schemabinding/version2/types/.castor.cdr @@ -1,4 +1,5 @@ -#Thu Dec 14 09:10:14 GMT 2017 +#Thu Dec 14 15:28:22 GMT 2017 jalview.schemabinding.version2.types.ColourNoValueColourType=jalview.schemabinding.version2.types.descriptors.ColourNoValueColourTypeDescriptor jalview.schemabinding.version2.types.FeatureMatcherByType=jalview.schemabinding.version2.types.descriptors.FeatureMatcherByTypeDescriptor +jalview.schemabinding.version2.types.NoValueColour=jalview.schemabinding.version2.types.descriptors.NoValueColourDescriptor jalview.schemabinding.version2.types.ColourThreshTypeType=jalview.schemabinding.version2.types.descriptors.ColourThreshTypeTypeDescriptor diff --git a/src/jalview/schemabinding/version2/types/ColourNoValueColourType.java b/src/jalview/schemabinding/version2/types/ColourNoValueColourType.java deleted file mode 100644 index 2674156..0000000 --- a/src/jalview/schemabinding/version2/types/ColourNoValueColourType.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ - */ - -package jalview.schemabinding.version2.types; - - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import java.util.Hashtable; - -/** - * Class ColourNoValueColourType. - * - * @version $Revision$ $Date$ - */ -public class ColourNoValueColourType implements java.io.Serializable { - - - //--------------------------/ - //- Class/Member Variables -/ - //--------------------------/ - - /** - * The None type - */ - public static final int NONE_TYPE = 0; - - /** - * The instance of the None type - */ - public static final ColourNoValueColourType NONE = new ColourNoValueColourType(NONE_TYPE, "None"); - - /** - * The Min type - */ - public static final int MIN_TYPE = 1; - - /** - * The instance of the Min type - */ - public static final ColourNoValueColourType MIN = new ColourNoValueColourType(MIN_TYPE, "Min"); - - /** - * The Max type - */ - public static final int MAX_TYPE = 2; - - /** - * The instance of the Max type - */ - public static final ColourNoValueColourType MAX = new ColourNoValueColourType(MAX_TYPE, "Max"); - - /** - * Field _memberTable. - */ - private static java.util.Hashtable _memberTable = init(); - - /** - * Field type. - */ - private int type = -1; - - /** - * Field stringValue. - */ - private java.lang.String stringValue = null; - - - //----------------/ - //- Constructors -/ - //----------------/ - - private ColourNoValueColourType(final int type, final java.lang.String value) { - super(); - this.type = type; - this.stringValue = value; - } - - - //-----------/ - //- Methods -/ - //-----------/ - - /** - * Method enumerate.Returns an enumeration of all possible - * instances of ColourNoValueColourType - * - * @return an Enumeration over all possible instances of - * ColourNoValueColourType - */ - public static java.util.Enumeration enumerate( - ) { - return _memberTable.elements(); - } - - /** - * Method getType.Returns the type of this - * ColourNoValueColourType - * - * @return the type of this ColourNoValueColourType - */ - public int getType( - ) { - return this.type; - } - - /** - * Method init. - * - * @return the initialized Hashtable for the member table - */ - private static java.util.Hashtable init( - ) { - Hashtable members = new Hashtable(); - members.put("None", NONE); - members.put("Min", MIN); - members.put("Max", MAX); - return members; - } - - /** - * Method readResolve. will be called during deserialization to - * replace the deserialized object with the correct constant - * instance. - * - * @return this deserialized object - */ - private java.lang.Object readResolve( - ) { - return valueOf(this.stringValue); - } - - /** - * Method toString.Returns the String representation of this - * ColourNoValueColourType - * - * @return the String representation of this - * ColourNoValueColourType - */ - public java.lang.String toString( - ) { - return this.stringValue; - } - - /** - * Method valueOf.Returns a new ColourNoValueColourType based - * on the given String value. - * - * @param string - * @return the ColourNoValueColourType value of parameter - * 'string' - */ - public static jalview.schemabinding.version2.types.ColourNoValueColourType valueOf( - final java.lang.String string) { - java.lang.Object obj = null; - if (string != null) { - obj = _memberTable.get(string); - } - if (obj == null) { - String err = "" + string + " is not a valid ColourNoValueColourType"; - throw new IllegalArgumentException(err); - } - return (ColourNoValueColourType) obj; - } - -} diff --git a/src/jalview/schemabinding/version2/types/NoValueColour.java b/src/jalview/schemabinding/version2/types/NoValueColour.java new file mode 100644 index 0000000..bbef3d7 --- /dev/null +++ b/src/jalview/schemabinding/version2/types/NoValueColour.java @@ -0,0 +1,169 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2.types; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + +import java.util.Hashtable; + +/** + * Graduated feature colour if no score (or attribute) value + * + * @version $Revision$ $Date$ + */ +public class NoValueColour implements java.io.Serializable +{ + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * The None type + */ + public static final int NONE_TYPE = 0; + + /** + * The instance of the None type + */ + public static final NoValueColour NONE = new NoValueColour(NONE_TYPE, + "None"); + + /** + * The Min type + */ + public static final int MIN_TYPE = 1; + + /** + * The instance of the Min type + */ + public static final NoValueColour MIN = new NoValueColour(MIN_TYPE, + "Min"); + + /** + * The Max type + */ + public static final int MAX_TYPE = 2; + + /** + * The instance of the Max type + */ + public static final NoValueColour MAX = new NoValueColour(MAX_TYPE, + "Max"); + + /** + * Field _memberTable. + */ + private static java.util.Hashtable _memberTable = init(); + + /** + * Field type. + */ + private int type = -1; + + /** + * Field stringValue. + */ + private java.lang.String stringValue = null; + + // ----------------/ + // - Constructors -/ + // ----------------/ + + private NoValueColour(final int type, final java.lang.String value) + { + super(); + this.type = type; + this.stringValue = value; + } + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Method enumerate.Returns an enumeration of all possible instances of + * NoValueColour + * + * @return an Enumeration over all possible instances of NoValueColour + */ + public static java.util.Enumeration enumerate() + { + return _memberTable.elements(); + } + + /** + * Method getType.Returns the type of this NoValueColour + * + * @return the type of this NoValueColour + */ + public int getType() + { + return this.type; + } + + /** + * Method init. + * + * @return the initialized Hashtable for the member table + */ + private static java.util.Hashtable init() + { + Hashtable members = new Hashtable(); + members.put("None", NONE); + members.put("Min", MIN); + members.put("Max", MAX); + return members; + } + + /** + * Method readResolve. will be called during deserialization to replace the + * deserialized object with the correct constant instance. + * + * @return this deserialized object + */ + private java.lang.Object readResolve() + { + return valueOf(this.stringValue); + } + + /** + * Method toString.Returns the String representation of this NoValueColour + * + * @return the String representation of this NoValueColour + */ + public java.lang.String toString() + { + return this.stringValue; + } + + /** + * Method valueOf.Returns a new NoValueColour based on the given String value. + * + * @param string + * @return the NoValueColour value of parameter 'string' + */ + public static jalview.schemabinding.version2.types.NoValueColour valueOf( + final java.lang.String string) + { + java.lang.Object obj = null; + if (string != null) + { + obj = _memberTable.get(string); + } + if (obj == null) + { + String err = "" + string + " is not a valid NoValueColour"; + throw new IllegalArgumentException(err); + } + return (NoValueColour) obj; + } + +} diff --git a/src/jalview/schemabinding/version2/types/descriptors/ColourNoValueColourTypeDescriptor.java b/src/jalview/schemabinding/version2/types/descriptors/ColourNoValueColourTypeDescriptor.java deleted file mode 100644 index 38c3df1..0000000 --- a/src/jalview/schemabinding/version2/types/descriptors/ColourNoValueColourTypeDescriptor.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ - */ - -package jalview.schemabinding.version2.types.descriptors; - - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import jalview.schemabinding.version2.types.ColourNoValueColourType; - -/** - * Class ColourNoValueColourTypeDescriptor. - * - * @version $Revision$ $Date$ - */ -public class ColourNoValueColourTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { - - - //--------------------------/ - //- Class/Member Variables -/ - //--------------------------/ - - /** - * Field _elementDefinition. - */ - private boolean _elementDefinition; - - /** - * Field _nsPrefix. - */ - private java.lang.String _nsPrefix; - - /** - * Field _nsURI. - */ - private java.lang.String _nsURI; - - /** - * Field _xmlName. - */ - private java.lang.String _xmlName; - - - //----------------/ - //- Constructors -/ - //----------------/ - - public ColourNoValueColourTypeDescriptor() { - super(); - _nsURI = "www.jalview.org/colours"; - _xmlName = "ColourNoValueColourType"; - _elementDefinition = false; - } - - - //-----------/ - //- Methods -/ - //-----------/ - - /** - * Method getAccessMode. - * - * @return the access mode specified for this class. - */ - public org.exolab.castor.mapping.AccessMode getAccessMode( - ) { - return null; - } - - /** - * Method getIdentity. - * - * @return the identity field, null if this class has no - * identity. - */ - public org.exolab.castor.mapping.FieldDescriptor getIdentity( - ) { - return super.getIdentity(); - } - - /** - * Method getJavaClass. - * - * @return the Java class represented by this descriptor. - */ - public java.lang.Class getJavaClass( - ) { - return jalview.schemabinding.version2.types.ColourNoValueColourType.class; - } - - /** - * Method getNameSpacePrefix. - * - * @return the namespace prefix to use when marshaling as XML. - */ - public java.lang.String getNameSpacePrefix( - ) { - return _nsPrefix; - } - - /** - * Method getNameSpaceURI. - * - * @return the namespace URI used when marshaling and - * unmarshaling as XML. - */ - public java.lang.String getNameSpaceURI( - ) { - return _nsURI; - } - - /** - * Method getValidator. - * - * @return a specific validator for the class described by this - * ClassDescriptor. - */ - public org.exolab.castor.xml.TypeValidator getValidator( - ) { - return this; - } - - /** - * Method getXMLName. - * - * @return the XML Name for the Class being described. - */ - public java.lang.String getXMLName( - ) { - return _xmlName; - } - - /** - * Method isElementDefinition. - * - * @return true if XML schema definition of this Class is that - * of a global - * element or element with anonymous type definition. - */ - public boolean isElementDefinition( - ) { - return _elementDefinition; - } - -} diff --git a/src/jalview/schemabinding/version2/types/descriptors/NoValueColourDescriptor.java b/src/jalview/schemabinding/version2/types/descriptors/NoValueColourDescriptor.java new file mode 100644 index 0000000..14c58ed --- /dev/null +++ b/src/jalview/schemabinding/version2/types/descriptors/NoValueColourDescriptor.java @@ -0,0 +1,147 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2.types.descriptors; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + +import jalview.schemabinding.version2.types.NoValueColour; + +/** + * Class NoValueColourDescriptor. + * + * @version $Revision$ $Date$ + */ +public class NoValueColourDescriptor + extends org.exolab.castor.xml.util.XMLClassDescriptorImpl +{ + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + // ----------------/ + // - Constructors -/ + // ----------------/ + + public NoValueColourDescriptor() + { + super(); + _nsURI = "www.jalview.org/colours"; + _xmlName = "NoValueColour"; + _elementDefinition = false; + } + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode() + { + return null; + } + + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity() + { + return super.getIdentity(); + } + + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass() + { + return jalview.schemabinding.version2.types.NoValueColour.class; + } + + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix() + { + return _nsPrefix; + } + + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI() + { + return _nsURI; + } + + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator() + { + return this; + } + + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName() + { + return _xmlName; + } + + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition() + { + return _elementDefinition; + } + +}