X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemabinding%2Fversion2%2Fdescriptors%2FJalviewUserColoursDescriptor.java;h=7167360214a274fe598aff25281615476a02cb8f;hb=d423f22792e47dbc800ae220a58677f988971d06;hp=9891a28f3476c5016e08227668e8bb58e82629bd;hpb=506d60f0e188723ddc91c26824b41ac7034df3fe;p=jalview.git diff --git a/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java b/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java index 9891a28..7167360 100644 --- a/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java @@ -1,29 +1,28 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) - * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5) + * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This file is part of Jalview. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ package jalview.schemabinding.version2.descriptors; -// ---------------------------------/ -// - Imported classes and packages -/ -// ---------------------------------/ +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ -import jalview.schemabinding.version2.Colour; import jalview.schemabinding.version2.JalviewUserColours; +import jalview.schemabinding.version2.Colour; /** * Class JalviewUserColoursDescriptor. @@ -123,6 +122,51 @@ public class JalviewUserColoursDescriptor extends desc.setValidator(fieldValidator); // -- initialize element descriptors + // -- _version + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( + java.lang.String.class, "_version", "Version", + 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 + { + JalviewUserColours target = (JalviewUserColours) object; + return target.getVersion(); + } + + public void setValue(java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try + { + JalviewUserColours target = (JalviewUserColours) object; + target.setVersion((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.setMultivalued(false); + addFieldDescriptor(desc); + + // -- validation code for: _version + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { // -- 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); // -- _colourList desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( Colour.class, "_colourList", "colour", @@ -168,13 +212,12 @@ public class JalviewUserColoursDescriptor extends } }; desc.setHandler(handler); - desc.setRequired(true); desc.setMultivalued(true); addFieldDescriptor(desc); // -- validation code for: _colourList fieldValidator = new org.exolab.castor.xml.FieldValidator(); - fieldValidator.setMinOccurs(1); + fieldValidator.setMinOccurs(0); { // -- local scope } desc.setValidator(fieldValidator);