From: jprocter Date: Mon, 2 Apr 2007 13:05:09 +0000 (+0000) Subject: added feature type order preference attribute and visible feature group state element X-Git-Tag: Release_2_3~282 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=e66214d1c10dd62afb50ea6a6e6952ae9cb0cc38 added feature type order preference attribute and visible feature group state element --- diff --git a/schemas/jalview.properties b/schemas/jalview.properties new file mode 100644 index 0000000..6508fcc --- /dev/null +++ b/schemas/jalview.properties @@ -0,0 +1,63 @@ +# +# Property file for SourceCodeGenerator +# +# $Id$ + +# To enable bound properties uncomment the following line. Please +# note that currently *all* fields will be treated as bound properties +# when enabled. This will change in the future when we introduce +# fine grained control over each class and it's properties. +# +#org.exolab.castor.builder.boundproperties=true + +# Java class mapping of 's and 's +# +#org.exolab.castor.builder.javaclassmapping=element + +# This property allows one to specify the super class of *all* +# generated classes +# +#org.exolab.castor.builder.superclass=com.xyz.BaseObject + +# XML namespace mapping to Java packages +# +#org.exolab.castor.builder.nspackages=\ + http://www.xyz.com/schemas/project=com.xyz.schemas.project,\ + http://www.xyz.com/schemas/person=com.xyz.schemas.person + +# Set to true if you want to generate the equals method +# for each generated class +# false by default +# +#org.exolab.castor.builder.equalsmethod=true + +# Set to true if you want to use Object Wrappers instead +# of primitives (e.g Float instead of float). +# false by default. +# +#org.exolab.castor.builder.primitivetowrapper=false + +# Set to true if you want the generated class descriptors to +# expose the element and attribute names they contain. +# false by default. +# +#org.exolab.castor.builder.classdescfieldnames=false + +# Set to true if you want the generated source code to contain +# Extra methods for the collection fields, such as get/set using +# the collection type in addition to the type-safe array. +# Set this to true if you want your code to be more compatible +# with Castor JDO. This is false by default. +# +#org.exolab.castor.builder.extraCollectionMethods=true + +# Use old-style (Castor 0.9.3.9) of naming that uppercases +# names after an underscore +# +#org.exolab.castor.xml.JavaNaming.upperCaseAfterUnderscore=true + +# This property specifies whether generated enumerated type +# classes implement the EnumeratedTypeAccess interface. +# false by default +#org.exolab.castor.builder.enumTypeAccessInterface=true + diff --git a/schemas/jalview.xsd b/schemas/jalview.xsd index 055710e..72a3273 100755 --- a/schemas/jalview.xsd +++ b/schemas/jalview.xsd @@ -1,194 +1,201 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/jalview/schemabinding/version2/FeatureSettings.java b/src/jalview/schemabinding/version2/FeatureSettings.java index c20a83c..6f64136 100755 --- a/src/jalview/schemabinding/version2/FeatureSettings.java +++ b/src/jalview/schemabinding/version2/FeatureSettings.java @@ -40,6 +40,11 @@ public class FeatureSettings implements java.io.Serializable { */ private java.util.Vector _settingList; + /** + * Field _groupList + */ + private java.util.Vector _groupList; + //----------------/ //- Constructors -/ @@ -48,6 +53,7 @@ public class FeatureSettings implements java.io.Serializable { public FeatureSettings() { super(); _settingList = new Vector(); + _groupList = new Vector(); } //-- jalview.schemabinding.version2.FeatureSettings() @@ -56,6 +62,33 @@ public class FeatureSettings implements java.io.Serializable { //-----------/ /** + * Method addGroup + * + * + * + * @param vGroup + */ + public void addGroup(jalview.schemabinding.version2.Group vGroup) + throws java.lang.IndexOutOfBoundsException + { + _groupList.addElement(vGroup); + } //-- void addGroup(jalview.schemabinding.version2.Group) + + /** + * Method addGroup + * + * + * + * @param index + * @param vGroup + */ + public void addGroup(int index, jalview.schemabinding.version2.Group vGroup) + throws java.lang.IndexOutOfBoundsException + { + _groupList.insertElementAt(vGroup, index); + } //-- void addGroup(int, jalview.schemabinding.version2.Group) + + /** * Method addSetting * * @@ -83,6 +116,18 @@ public class FeatureSettings implements java.io.Serializable { } //-- void addSetting(int, jalview.schemabinding.version2.Setting) /** + * Method enumerateGroup + * + * + * + * @return Enumeration + */ + public java.util.Enumeration enumerateGroup() + { + return _groupList.elements(); + } //-- java.util.Enumeration enumerateGroup() + + /** * Method enumerateSetting * * @@ -95,6 +140,54 @@ public class FeatureSettings implements java.io.Serializable { } //-- java.util.Enumeration enumerateSetting() /** + * Method getGroup + * + * + * + * @param index + * @return Group + */ + public jalview.schemabinding.version2.Group getGroup(int index) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _groupList.size())) { + throw new IndexOutOfBoundsException(); + } + + return (jalview.schemabinding.version2.Group) _groupList.elementAt(index); + } //-- jalview.schemabinding.version2.Group getGroup(int) + + /** + * Method getGroup + * + * + * + * @return Group + */ + public jalview.schemabinding.version2.Group[] getGroup() + { + int size = _groupList.size(); + jalview.schemabinding.version2.Group[] mArray = new jalview.schemabinding.version2.Group[size]; + for (int index = 0; index < size; index++) { + mArray[index] = (jalview.schemabinding.version2.Group) _groupList.elementAt(index); + } + return mArray; + } //-- jalview.schemabinding.version2.Group[] getGroup() + + /** + * Method getGroupCount + * + * + * + * @return int + */ + public int getGroupCount() + { + return _groupList.size(); + } //-- int getGroupCount() + + /** * Method getSetting * * @@ -189,6 +282,15 @@ public class FeatureSettings implements java.io.Serializable { } //-- void marshal(org.xml.sax.ContentHandler) /** + * Method removeAllGroup + * + */ + public void removeAllGroup() + { + _groupList.removeAllElements(); + } //-- void removeAllGroup() + + /** * Method removeAllSetting * */ @@ -198,6 +300,21 @@ public class FeatureSettings implements java.io.Serializable { } //-- void removeAllSetting() /** + * Method removeGroup + * + * + * + * @param index + * @return Group + */ + public jalview.schemabinding.version2.Group removeGroup(int index) + { + java.lang.Object obj = _groupList.elementAt(index); + _groupList.removeElementAt(index); + return (jalview.schemabinding.version2.Group) obj; + } //-- jalview.schemabinding.version2.Group removeGroup(int) + + /** * Method removeSetting * * @@ -213,6 +330,40 @@ public class FeatureSettings implements java.io.Serializable { } //-- jalview.schemabinding.version2.Setting removeSetting(int) /** + * Method setGroup + * + * + * + * @param index + * @param vGroup + */ + public void setGroup(int index, jalview.schemabinding.version2.Group vGroup) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _groupList.size())) { + throw new IndexOutOfBoundsException(); + } + _groupList.setElementAt(vGroup, index); + } //-- void setGroup(int, jalview.schemabinding.version2.Group) + + /** + * Method setGroup + * + * + * + * @param groupArray + */ + public void setGroup(jalview.schemabinding.version2.Group[] groupArray) + { + //-- copy array + _groupList.removeAllElements(); + for (int i = 0; i < groupArray.length; i++) { + _groupList.addElement(groupArray[i]); + } + } //-- void setGroup(jalview.schemabinding.version2.Group) + + /** * Method setSetting * * diff --git a/src/jalview/schemabinding/version2/FeatureSettingsDescriptor.java b/src/jalview/schemabinding/version2/FeatureSettingsDescriptor.java index 219037e..6b55286 100755 --- a/src/jalview/schemabinding/version2/FeatureSettingsDescriptor.java +++ b/src/jalview/schemabinding/version2/FeatureSettingsDescriptor.java @@ -102,6 +102,41 @@ public class FeatureSettingsDescriptor extends org.exolab.castor.xml.util.XMLCla { //-- local scope } desc.setValidator(fieldValidator); + //-- _groupList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Group.class, "_groupList", "group", org.exolab.castor.xml.NodeType.Element); + handler = (new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + FeatureSettings target = (FeatureSettings) object; + return target.getGroup(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + FeatureSettings target = (FeatureSettings) object; + target.addGroup( (jalview.schemabinding.version2.Group) 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.Group(); + } + } ); + desc.setHandler(handler); + desc.setNameSpaceURI("www.jalview.org"); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + //-- validation code for: _groupList + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(0); + { //-- local scope + } + desc.setValidator(fieldValidator); } //-- jalview.schemabinding.version2.FeatureSettingsDescriptor() diff --git a/src/jalview/schemabinding/version2/Group.java b/src/jalview/schemabinding/version2/Group.java new file mode 100644 index 0000000..cdb082d --- /dev/null +++ b/src/jalview/schemabinding/version2/Group.java @@ -0,0 +1,200 @@ +/* + * This class was automatically generated with + * Castor 0.9.6, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import java.io.IOException; +import java.io.Reader; +import java.io.Serializable; +import java.io.Writer; +import org.exolab.castor.xml.MarshalException; +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; +import org.exolab.castor.xml.ValidationException; +import org.xml.sax.ContentHandler; + +/** + * Class Group. + * + * @version $Revision$ $Date$ + */ +public class Group implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _name + */ + private java.lang.String _name; + + /** + * Field _display + */ + private boolean _display; + + /** + * keeps track of state for field: _display + */ + private boolean _has_display; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Group() { + super(); + } //-- jalview.schemabinding.version2.Group() + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method deleteDisplay + * + */ + public void deleteDisplay() + { + this._has_display= false; + } //-- void deleteDisplay() + + /** + * Returns the value of field 'display'. + * + * @return boolean + * @return the value of field 'display'. + */ + public boolean getDisplay() + { + return this._display; + } //-- boolean getDisplay() + + /** + * Returns the value of field 'name'. + * + * @return String + * @return the value of field 'name'. + */ + public java.lang.String getName() + { + return this._name; + } //-- java.lang.String getName() + + /** + * Method hasDisplay + * + * + * + * @return boolean + */ + public boolean hasDisplay() + { + return this._has_display; + } //-- boolean hasDisplay() + + /** + * Method isValid + * + * + * + * @return boolean + */ + public boolean isValid() + { + try { + validate(); + } + catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } //-- boolean isValid() + + /** + * Method marshal + * + * + * + * @param out + */ + public void marshal(java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, out); + } //-- void marshal(java.io.Writer) + + /** + * Method marshal + * + * + * + * @param handler + */ + public void marshal(org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, handler); + } //-- void marshal(org.xml.sax.ContentHandler) + + /** + * Sets the value of field 'display'. + * + * @param display the value of field 'display'. + */ + public void setDisplay(boolean display) + { + this._display = display; + this._has_display = true; + } //-- void setDisplay(boolean) + + /** + * Sets the value of field 'name'. + * + * @param name the value of field 'name'. + */ + public void setName(java.lang.String name) + { + this._name = name; + } //-- void setName(java.lang.String) + + /** + * Method unmarshal + * + * + * + * @param reader + * @return Object + */ + public static java.lang.Object unmarshal(java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + return (jalview.schemabinding.version2.Group) Unmarshaller.unmarshal(jalview.schemabinding.version2.Group.class, reader); + } //-- java.lang.Object unmarshal(java.io.Reader) + + /** + * Method validate + * + */ + public void validate() + throws org.exolab.castor.xml.ValidationException + { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } //-- void validate() + +} diff --git a/src/jalview/schemabinding/version2/GroupDescriptor.java b/src/jalview/schemabinding/version2/GroupDescriptor.java new file mode 100644 index 0000000..c41175b --- /dev/null +++ b/src/jalview/schemabinding/version2/GroupDescriptor.java @@ -0,0 +1,249 @@ +/* + * This class was automatically generated with + * Castor 0.9.6, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import org.exolab.castor.mapping.AccessMode; +import org.exolab.castor.xml.TypeValidator; +import org.exolab.castor.xml.XMLFieldDescriptor; +import org.exolab.castor.xml.validators.*; + +/** + * Class GroupDescriptor. + * + * @version $Revision$ $Date$ + */ +public class GroupDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field nsPrefix + */ + private java.lang.String nsPrefix; + + /** + * Field nsURI + */ + private java.lang.String nsURI; + + /** + * Field xmlName + */ + private java.lang.String xmlName; + + /** + * Field identity + */ + private org.exolab.castor.xml.XMLFieldDescriptor identity; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public GroupDescriptor() { + super(); + nsURI = "www.jalview.org"; + xmlName = "group"; + org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; + org.exolab.castor.xml.XMLFieldHandler handler = null; + org.exolab.castor.xml.FieldValidator fieldValidator = null; + //-- initialize attribute descriptors + + //-- _name + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = (new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Group target = (Group) object; + return target.getName(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Group target = (Group) object; + target.setName( (java.lang.String) value); + } + 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.setRequired(true); + addFieldDescriptor(desc); + + //-- validation code for: _name + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + StringValidator typeValidator = new StringValidator(); + typeValidator.setWhiteSpace("preserve"); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); + //-- _display + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_display", "display", org.exolab.castor.xml.NodeType.Attribute); + handler = (new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Group target = (Group) object; + if(!target.hasDisplay()) + return null; + return (target.getDisplay() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Group target = (Group) object; + // ignore null values for non optional primitives + if (value == null) return; + + target.setDisplay( ((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.setRequired(true); + addFieldDescriptor(desc); + + //-- validation code for: _display + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + BooleanValidator typeValidator = new BooleanValidator(); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); + //-- initialize element descriptors + + } //-- jalview.schemabinding.version2.GroupDescriptor() + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getAccessMode + * + * + * + * @return AccessMode + */ + public org.exolab.castor.mapping.AccessMode getAccessMode() + { + return null; + } //-- org.exolab.castor.mapping.AccessMode getAccessMode() + + /** + * Method getExtends + * + * + * + * @return ClassDescriptor + */ + public org.exolab.castor.mapping.ClassDescriptor getExtends() + { + return null; + } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() + + /** + * Method getIdentity + * + * + * + * @return FieldDescriptor + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity() + { + return identity; + } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() + + /** + * Method getJavaClass + * + * + * + * @return Class + */ + public java.lang.Class getJavaClass() + { + return jalview.schemabinding.version2.Group.class; + } //-- java.lang.Class getJavaClass() + + /** + * Method getNameSpacePrefix + * + * + * + * @return String + */ + public java.lang.String getNameSpacePrefix() + { + return nsPrefix; + } //-- java.lang.String getNameSpacePrefix() + + /** + * Method getNameSpaceURI + * + * + * + * @return String + */ + public java.lang.String getNameSpaceURI() + { + return nsURI; + } //-- java.lang.String getNameSpaceURI() + + /** + * Method getValidator + * + * + * + * @return TypeValidator + */ + public org.exolab.castor.xml.TypeValidator getValidator() + { + return this; + } //-- org.exolab.castor.xml.TypeValidator getValidator() + + /** + * Method getXMLName + * + * + * + * @return String + */ + public java.lang.String getXMLName() + { + return xmlName; + } //-- java.lang.String getXMLName() + +} diff --git a/src/jalview/schemabinding/version2/Setting.java b/src/jalview/schemabinding/version2/Setting.java index 668ef9d..d276b9f 100755 --- a/src/jalview/schemabinding/version2/Setting.java +++ b/src/jalview/schemabinding/version2/Setting.java @@ -58,6 +58,16 @@ public class Setting implements java.io.Serializable { */ private boolean _has_display; + /** + * Field _order + */ + private float _order; + + /** + * keeps track of state for field: _order + */ + private boolean _has_order; + //----------------/ //- Constructors -/ @@ -91,6 +101,15 @@ public class Setting implements java.io.Serializable { } //-- void deleteDisplay() /** + * Method deleteOrder + * + */ + public void deleteOrder() + { + this._has_order= false; + } //-- void deleteOrder() + + /** * Returns the value of field 'colour'. * * @return int @@ -113,6 +132,17 @@ public class Setting implements java.io.Serializable { } //-- boolean getDisplay() /** + * Returns the value of field 'order'. + * + * @return float + * @return the value of field 'order'. + */ + public float getOrder() + { + return this._order; + } //-- float getOrder() + + /** * Returns the value of field 'type'. * * @return String @@ -148,6 +178,18 @@ public class Setting implements java.io.Serializable { } //-- boolean hasDisplay() /** + * Method hasOrder + * + * + * + * @return boolean + */ + public boolean hasOrder() + { + return this._has_order; + } //-- boolean hasOrder() + + /** * Method isValid * * @@ -216,6 +258,17 @@ public class Setting implements java.io.Serializable { } //-- void setDisplay(boolean) /** + * Sets the value of field 'order'. + * + * @param order the value of field 'order'. + */ + public void setOrder(float order) + { + this._order = order; + this._has_order = true; + } //-- void setOrder(float) + + /** * Sets the value of field 'type'. * * @param type the value of field 'type'. diff --git a/src/jalview/schemabinding/version2/SettingDescriptor.java b/src/jalview/schemabinding/version2/SettingDescriptor.java index 6cadc16..a96d57d 100755 --- a/src/jalview/schemabinding/version2/SettingDescriptor.java +++ b/src/jalview/schemabinding/version2/SettingDescriptor.java @@ -182,6 +182,47 @@ public class SettingDescriptor extends org.exolab.castor.xml.util.XMLClassDescri fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); + //-- _order + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(float.class, "_order", "order", 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; + if(!target.hasOrder()) + return null; + return new java.lang.Float(target.getOrder()); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Setting target = (Setting) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteOrder(); + return; + } + target.setOrder( ((java.lang.Float)value).floatValue()); + } + catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance( java.lang.Object parent ) { + return null; + } + } ); + desc.setHandler(handler); + addFieldDescriptor(desc); + + //-- validation code for: _order + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + FloatValidator typeValidator = new FloatValidator(); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); //-- initialize element descriptors } //-- jalview.schemabinding.version2.SettingDescriptor()